>>     def main(self):
>>         self.ReportServiceStatus(win32service.SERVICE_RUNNING)
>>         while not self.stop_requested.is_set():
>>             time.sleep(1)  # So something useful here
> Why don't you use the Windows Event (hWaitStop) with
> WaitForSingleObject instead of an additional threading.Event?

The main question is: why does this work? What should be different?

About why I use a threading Event instead instead of a Windows event -
production code is similar to this:

 def main(self):
        self.ReportServiceStatus(win32service.SERVICE_RUNNING)
        worker = Worker(self.stop_requested)
        worker.join()


The worker class does the real job.  The win32 service code is only a
wrapper around it. The service can also be started from unix (with an rc
script). In the unix style application, there is another wrapper that
sets up signal handlers, writes out a pid file and starts the same
worker object. The worker must work on both platforms, this is why I
must use platform independent object.

But again, that is not related to the question. Why does it not work?
What is missing?

Thanks,

  Laszlo




-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to