Patches: Browse | Submit New | Admin
Here are some patches for win32-service which eliminate the messy busy loop that polls the hStopEvent with a zero timeout. Instead of using a Windows event, these patches create a UDP/IP socket bound to the loopback interface which can be used in ruby's green threads event loop. I believe this is a much cleaner and more efficient mechanism than the WIndows event flag since it allows the ruby thread to block until there's really a control event from the WIndows service manager. I also include a hCtrlEvent event flag which can be used by ruby win32 services which must wait for control events. This event handle is accessible via the daemon.event_handle method. Note that the hCtrlEvent is not used by the daemon.c logic, it's merely an event which can be used by the Daemon subclass.
Add A Comment:
Date: 2008-11-10 22:34 Sender: Daniel Berger We've been looking at this implementation again, and Park has implemented a version in pure Ruby. The downside, at the moment, is that there's a socket bug in the one-click that would make this problematic. Regards, Dan
Date: 2008-02-16 04:54 Sender: Daniel Berger I haven't yet had a chance to seriously review this but I definitely haven't forgotten it! Thanks, Dan