[Win32utils-devel] [ win32utils-Patches-16627 ] Replace inefficient busy wait loop with UDP/IP loopback socket.

noreply at rubyforge.org noreply at rubyforge.org
Fri Jan 10 15:45:50 UTC 2014


Patches item #16627, was opened at 2007-12-26 19:13
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=413&aid=16627&group_id=85

Category: win32-service
Group: Code Cleanup
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: Replace inefficient busy wait loop with UDP/IP loopback socket.

Initial Comment:
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.

----------------------------------------------------------------------

>Comment By: Daniel Berger (djberg96)
Date: 2014-01-10 08:45

Message:
We converted the code to pure Ruby using FFI not too long ago, but we did not use this implementation. However, I'm still open to the idea if you feel it's still relevant for Ruby 1.9 or later.

----------------------------------------------------------------------

Comment By: Daniel Berger (djberg96)
Date: 2008-11-10 15:34

Message:
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

----------------------------------------------------------------------

Comment By: Daniel Berger (djberg96)
Date: 2008-02-15 21:54

Message:
I haven't yet had a chance to seriously review this but I definitely haven't forgotten it!

Thanks,

Dan

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=413&aid=16627&group_id=85


More information about the win32utils-devel mailing list