Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
No Version
-
None
Description
On Windows, a service that takes time to shut down should inform the service control manager regularly about the progress by calling SetServiceStatus. Otherwise, the OS might just kill the process after a certain timeout.
Doing this with QtService is right now not possible, as the respective datastructures are private. It would be useful to ahve a new function
void QtServiceBase::setStatusProgress(int progress, int timeToNext)
{
if (!d_ptr->sysd || !d_ptr->sysd->available())
return;
d_ptr->sysd->status.dwCheckPoint = progress;
d_ptr->sysd->status.dwWaitHint = timeToNext;
d_ptr->sysd->setStatus(d_ptr->sysd->status.dwCurrentState);
}
and modifying setStatus to reset the state:
void QtServiceSysPrivate::setStatus(DWORD state)
{
if (!available())
return;
if (state != status.dwCurrentState)
status.dwCurrentState = state;
pSetServiceStatus(serviceStatus, &status);
}
On other platforms than Windows, setStatusProgress wouldn't do anything.
Windows Vista has additional new functionality that could be utilized in the QtService API or implementation.