[Win32utils-devel] Win32 service and blocking code in service_main
luislavena at gmail.com
Mon Feb 20 14:43:28 EST 2006
Hello mailing list!
Sorry for the personal/private mail I sent to Daniel and Park, but
just a few minutes ago I subscribed to this list.
I have found the solution, for webrick, mongrel and other webserver
(well I guess).
If the code in service_main is blocked (like the webrick dispatcher),
the service_main function never exit/left, so service.mainloop never
terminates and service control timeout.
What I have done is put the running dispatcher in a Thread that is
fired by service_main, and then I loop (like you have said Park) using
small sleep values until state != RUNNING, which is signaled during a
Now mongrel and webrick start and stop without problems, from
controller script or using the Services console (or command line "net
Because mongrel dispatch working threads, there is no need to create
another one that join with them, just I have added comments to the
code that could be useful with webrick too.
Regards and thank you for your time,
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3738 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/win32utils-devel/attachments/20060220/1e0d7bee/mongrel_simple_service-0001.obj
More information about the win32utils-devel