Inter process signalling

  • Thread starter Dale Strickland-Clark
  • Start date
D

Dale Strickland-Clark

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.

Thanks
 
D

Dale Strickland-Clark

Dale said:
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.

Thanks
The essential bit of information missing from this is: on Windows.

I want to signal between processes running *on Windows*.

That's what happens when you try to rush a post before going home.
Thank you for your tolerance.
 
D

Dennis Lee Bieber

The essential bit of information missing from this is: on Windows.

I want to signal between processes running *on Windows*.
Unfortunately... You are on Windows...

I think your choices become: Block, or Poll

Check the Win32Api modules...

win32event may be a candidate...
CreateEvent()
OpenEvent()
PulseEvent()
SetEvent()
ResetEvent()
WaitForSingleObject() or WaitForMultipleObjects()
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
D

Dale Strickland-Clark

Dennis said:
Unfortunately... You are on Windows...

I think your choices become: Block, or Poll

Check the Win32Api modules...

win32event may be a candidate...
CreateEvent()
OpenEvent()
PulseEvent()
SetEvent()
ResetEvent()
WaitForSingleObject() or WaitForMultipleObjects()

Thanks. We'll look into those.
 
D

Duncan Booth

Dale Strickland-Clark said:
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).
 
D

Dale Strickland-Clark

Duncan said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top