Signals and threads again

Discussion in 'Python' started by Mitko Haralanov, Oct 13, 2006.

  1. Hi everyone,

    First off, I know that this has been discussed before and I did a
    search but could not find anything that helped my situation.

    Here is the problem: I have a Python program that uses threads, forked
    processes, and signals and I can't seem to understand where the signals
    go.

    When the program starts, it creates a thread, which spins in select
    until and event is set. After the thread is spawned, the main thread
    goes on to created several child processes (using os.fork and
    os.execvp) and then it joins the spinning thread. The main thread sets
    a signal handler for SIGINT (Ctrl-C) before it joins the spinning
    thread.

    The problem that I am experiencing is that when SIGINT is sent to the
    program, it gets delivered to the child processes (the fork'ed ones)
    but the main thread's signal handler is never invoked.

    I know that Python masks signals in threads but they should be fine in
    the main thread and that is where they should get delivered.

    Any insight into this problem would be appreciated?

    --
    -- Mitko
    Mitko Haralanov, Oct 13, 2006
    #1
    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. Gabriele Bartolini

    Signals, threads and the use of SIGUSR1

    Gabriele Bartolini, Oct 3, 2003, in forum: C++
    Replies:
    4
    Views:
    1,512
    Peter Zijlstra
    Oct 11, 2003
  2. Srikanth Mandava
    Replies:
    1
    Views:
    379
    Michael Hudson
    Feb 19, 2004
  3. bill

    signals (again)

    bill, Aug 10, 2005, in forum: Python
    Replies:
    4
    Views:
    325
  4. Chad J. Schroeder

    Threads and signals

    Chad J. Schroeder, Nov 15, 2006, in forum: Python
    Replies:
    1
    Views:
    332
    Chad J. Schroeder
    Nov 16, 2006
  5. shibu-kundara

    Signals and threads

    shibu-kundara, Nov 24, 2006, in forum: C Programming
    Replies:
    2
    Views:
    310
    Mark McIntyre
    Nov 24, 2006
Loading...

Share This Page