Signals and threads again

Mitko Haralanov mitko at
Fri Oct 13 20:37:46 CEST 2006

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

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

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

More information about the Python-list mailing list