Inter process signalling

Discussion in 'Python' started by Dale Strickland-Clark, Sep 12, 2006.

  1. 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
    --
    Dale Strickland-Clark
    Riverhall Systems www.riverhall.co.uk
     
    Dale Strickland-Clark, Sep 12, 2006
    #1
    1. Advertising

  2. Dale Strickland-Clark 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.
    >
    > 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.
    --
    Dale Strickland-Clark
    Riverhall Systems www.riverhall.co.uk
     
    Dale Strickland-Clark, Sep 12, 2006
    #2
    1. Advertising

  3. On Tue, 12 Sep 2006 18:01:27 +0100, Dale Strickland-Clark
    <> declaimed the following in
    comp.lang.python:

    > 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

    HTTP://wlfraed.home.netcom.com/
    (Bestiaria Support Staff: )
    HTTP://www.bestiaria.com/
     
    Dennis Lee Bieber, Sep 13, 2006
    #3
  4. Dennis Lee Bieber wrote:

    > 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.
    --
    Dale Strickland-Clark
    Riverhall Systems - www.riverhall.co.uk
     
    Dale Strickland-Clark, Sep 13, 2006
    #4
  5. Dale Strickland-Clark

    Duncan Booth Guest

    Dale Strickland-Clark <> 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).
     
    Duncan Booth, Sep 13, 2006
    #5
  6. Duncan Booth wrote:

    > Dale Strickland-Clark <> 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
     
    Dale Strickland-Clark, Sep 13, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Knute Johnson
    Replies:
    0
    Views:
    829
    Knute Johnson
    Jun 27, 2003
  2. Jon A. Cruz
    Replies:
    0
    Views:
    739
    Jon A. Cruz
    Jun 28, 2003
  3. Replies:
    1
    Views:
    499
    Anthony Borla
    Feb 21, 2005
  4. Geronimo Stempovski

    HCM / LCM signalling

    Geronimo Stempovski, Feb 7, 2007, in forum: VHDL
    Replies:
    3
    Views:
    582
    Jon Slaughter
    Feb 7, 2007
  5. John Nagle
    Replies:
    2
    Views:
    264
    John Nagle
    Jan 26, 2008
Loading...

Share This Page