[Win32utils-devel] win32-service patch

Heesob Park phasis at gmail.com
Mon Jun 19 21:18:57 EDT 2006


Hi,

2006/6/20, Patrick Hurley <phurley at gmail.com>:
> Attached is a patch and my service.c if there is any difficulty
> applying the patch. I did the following:
>
> 1. Created a ruby thread (Ruby_Service_Ctrl), that polls against a
> simple integer value (protected by a critical section). I was worried
> this would be "expensive"; however, I found the rb_thread_polling
> method and it seems to work well.
>
> 2. When an event occurs in Service_Ctrl it sets the flag value.
>
> 3. If Ruby_Service_Ctrl finds an entry in the call back hash it
> invokes it (in its own thread) and goes back to polling
>
> 4. On a SERVICE_CONTROL_STOP the Ruby_Service_Ctrl, processes normally
> and then begins to exit, but it first waits for all previously spun
> threads to return.
>
> 5. Service_Ctrl on a stop waits for Ruby_Service_Ctrl to indicate that
> all threads are stopped before stopping the service (it continues to
> update service status politley).
>
> That's it -- in my tests it works perfectly. If I made any fax paus in
> my patch creation or summary please let me know.
>
> Thanks again
> pth
>
That is a really good pacth!
I confirmed the patch works perfectly.

Thanks,

Park Heesob


More information about the win32utils-devel mailing list