medusa as win32 service

Giles Brown giles_brown at
Mon Dec 1 09:44:09 CET 2003

Robin Becker <robin at> wrote in message news:<WnWU+VAnDjy$EwEP at>...
> I wonder if this is the right way to write a medusa(asyncore) server
> with the win32all framework. Other example services seem to create an
> event to pass the stop signal from SvcStop into a separate termination
> method, but I'm unsure how that would mix with the polling loop. 
> This simple framework seems to start and stop OK, but I wonder if I'm
> missing some obvious race or something.

I think the cleanest design for this is to use the
medusa.threading.select_trigger function to send an asyncore.ExitNow
exception into the main select loop.  The only problem with this is
that the current medusa.threading.select_trigger (in the sourceforge
medusa version) catches (and does not re-raise) this exception.  I've
modified our code so that it does not catch it and this seems to work
very well (we have a web server using medusa that runs as a service).

Giles Brown

More information about the Python-list mailing list