Signals and threads again

M

Mitko Haralanov

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?
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top