[Win32utils-devel] win32-service patch

Daniel Berger djberg96 at gmail.com
Mon Jun 19 21:23:05 EDT 2006

Patrick Hurley wrote:
> 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
> ------------------------------------------------------------------------
> _______________________________________________
> win32utils-devel mailing list
> win32utils-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/win32utils-devel
Many thanks Patrick, we'll take a look.  In the meantime I'm going to 
release 0.5.1 (tonight).  Assuming everything looks good with your 
patch, I'm going to save it for 0.5.2.



PS - Sorry for the late approval on this message - I was at work.

More information about the win32utils-devel mailing list