Uploaded image for project: 'Qt Solutions'
  1. Qt Solutions
  2. QTSOLBUG-24

More control over QtService startup and shutdown progress

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • Not Scheduled
    • No Version
    • Service
    • 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.dwCheckPoint = 0; status.dwWaitHint = 5000; // 5 seconds default timeout }

      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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes