|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Service::callbackTimeout_ms = 30 * 1000;
|
|
|
int Service::callbackTimeout_ms = 30 * 1000;
|
|
|
|
|
|
|
|
|
Service::Service() :
|
|
|
|
|
|
callbacksActive(true) {
|
|
|
|
|
|
|
|
|
Service::Service() {
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
Service &Service::getInstance() {
|
|
|
Service &Service::getInstance() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_LOG_FILE
|
|
|
#ifdef DEBUG_LOG_FILE
|
|
|
std::ofstream logStream;
|
|
|
std::ofstream logStream;
|
|
|
|
|
|
auto startTime = std::chrono::steady_clock::now();
|
|
|
|
|
|
|
|
|
logStream.open(DEBUG_LOG_FILE, std::fstream::app);
|
|
|
logStream.open(DEBUG_LOG_FILE, std::fstream::app);
|
|
|
logStream << "processCtrlMessage. message: " << message << std::endl;
|
|
|
logStream << "processCtrlMessage. message: " << message << std::endl;
|
|
|
logStream.close();
|
|
|
logStream.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pauseReceived = true;
|
|
|
pauseReceived = true;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_LOG_FILE
|
|
|
|
|
|
startTime = std::chrono::steady_clock::now();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
for (auto callback : pauseCallbacks) {
|
|
|
for (auto callback : pauseCallbacks) {
|
|
|
(*callback)();
|
|
|
(*callback)();
|
|
|
serviceStatus.dwCheckPoint++;
|
|
|
serviceStatus.dwCheckPoint++;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_LOG_FILE
|
|
|
|
|
|
logStream.open(DEBUG_LOG_FILE, std::fstream::app);
|
|
|
|
|
|
logStream << "Service::processCtrlMessage. "
|
|
|
|
|
|
<< "Cumulative time after callback (ms): "
|
|
|
|
|
|
<< std::chrono::duration_cast<std::chrono::milliseconds>
|
|
|
|
|
|
(std::chrono::steady_clock::now() - startTime).count()
|
|
|
|
|
|
<< ", dwWaitHint: " << serviceStatus.dwWaitHint
|
|
|
|
|
|
<< std::endl;
|
|
|
|
|
|
logStream.close();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
(void) SetServiceStatus(serviceStatusHandle, &serviceStatus);
|
|
|
(void) SetServiceStatus(serviceStatusHandle, &serviceStatus);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_LOG_FILE
|
|
|
|
|
|
logStream.open(DEBUG_LOG_FILE, std::fstream::app);
|
|
|
|
|
|
logStream << "Service::processCtrlMessage. "
|
|
|
|
|
|
<< "Cumulative time after SetServiceStatus (ms): "
|
|
|
|
|
|
<< std::chrono::duration_cast<std::chrono::milliseconds>
|
|
|
|
|
|
(std::chrono::steady_clock::now() - startTime).count()
|
|
|
|
|
|
<< std::endl;
|
|
|
|
|
|
logStream.close();
|
|
|
|
|
|
#endif
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
serviceStatus.dwControlsAccepted =
|
|
|
serviceStatus.dwControlsAccepted =
|
|
|
|
|
|
|
|
|
serviceStatus.dwCheckPoint = 0;
|
|
|
serviceStatus.dwCheckPoint = 0;
|
|
|
(void) SetServiceStatus(serviceStatusHandle, &serviceStatus);
|
|
|
(void) SetServiceStatus(serviceStatusHandle, &serviceStatus);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_LOG_FILE
|
|
|
|
|
|
logStream.open(DEBUG_LOG_FILE, std::fstream::app);
|
|
|
|
|
|
logStream << "Service::processCtrlMessage. "
|
|
|
|
|
|
<< "Cumulative time after final SetServiceStatus (ms): "
|
|
|
|
|
|
<< std::chrono::duration_cast<std::chrono::milliseconds>
|
|
|
|
|
|
(std::chrono::steady_clock::now() - startTime).count()
|
|
|
|
|
|
<< std::endl;
|
|
|
|
|
|
logStream.close();
|
|
|
|
|
|
#endif
|
|
|
break;
|
|
|
break;
|
|
|
|
|
|
|
|
|
case SERVICE_CONTROL_CONTINUE:
|
|
|
case SERVICE_CONTROL_CONTINUE:
|