if you implement service registration, perhaps the simplest way would be with a pair of .bat files for windows that will register and unregister the service, then there's no unclean code, and it's not difficult to do for the less windows minded.

On 9/19/2010 12:18 PM, Denis Krjuchkov wrote:
 Hello all again.

I've implemented Windows service support for MPD.
Also this patch adds console handler that traps "Ctrl+C" and "close window" events and performs clean shutdown. Looks like current implementation does not handle shutdown at all and simply quits when it gets Ctrl+C.

Some notes on implementation:

I've added PIPE_EVENT_SHUTDOWN because calling g_main_loop_quit() do not work when called from another thread.
Main thread was sleeping in g_poll() so I needed some way to wake it up.

By some strange reason call close(event_pipe[0]) in event_pipe_deinit() hangs. In current implementation that code never reached so that was not a problem :-)
I've added a conditional to leave event_pipe[0] open on Win32.

Currently there is no registration/unregistration functionality
Service can be registered with SC tool (sc.exe)
I want to implement registration however I'm not sure whenever this should be a separate program or code inside main MPD program.

Please find patches in the attached files.


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev


_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to