Inter process signalling

Dale Strickland-Clark dale at riverhall.nospam.co.uk
Wed Sep 13 05:24:07 EDT 2006


Duncan Booth wrote:

> Dale Strickland-Clark <dale at riverhall.nospam.co.uk> wrote:
> 
>> In Linux this is easy with 'signal' and 'kill' but how can I get one
>> Python process to signal another (possibly running as a service)?
>> 
>> All I need is a simple prod with no other data being sent and none
>> being returned - except that the signal was delivered.
>> 
>> Receiving a signal should generate an interrupt. I'm not looking for a
>> solution the involves polling.
>> 
> Lots of ways. Basically all involving creating a thread which waits on an
> event and then calls your code when the event is generated.
> 
> You can use semaphores, named pipes &c.; you could create a windows
> message queue and simply send the process a message when you want to alert
> it; you could create a COM server and call a method on it; you could use
> asynchronous procedure calls (APCs) (but you still need to ensure that
> there is a thread in an alertable wait state).
> 
> If the code you want to signal is running as a service then the easiest
> way to signal it is to call win32service.ControlService with a user
> defined service code. That gives you 127 signals to play with, and
> Python's win32 library will simply call the SvcOther method within your
> service code (although not of course using the same thread as the actual
> service is running on).

Thanks Duncan.
-- 
Dale Strickland-Clark
Riverhall Systems - www.riverhall.co.uk




More information about the Python-list mailing list