[Win32utils-devel] win32-service patch

Patrick Hurley phurley at gmail.com
Mon Jun 19 15:23:54 EDT 2006

This is a second post of this message -- service.c was too big and
caused the list to bounce it. Attached is a patch and my service.c.bz2
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: green_thread.patch
Type: application/octet-stream
Size: 4627 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/win32utils-devel/attachments/20060619/6dcb340c/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: service.c.bz2
Type: application/x-bzip2
Size: 9650 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/win32utils-devel/attachments/20060619/6dcb340c/attachment-0001.bin 

More information about the win32utils-devel mailing list