multiprocessing and SIGINT

akineko akineko at gmail.com
Wed Jan 7 04:24:56 EST 2009


Hello everyone,

I'm trying to use multiprocessing module, which is now available with
Python 2.6.
It is a nice enhancement and it worked great.

However, I have a situation and I couldn't figure out how to deal
with.

My Python program spawns another process to take care of GUI house-
keeping.
When I type Ctrl-C to my terminal, instead of my main process, the
spawned process always gets the SIGINT.

I don't want the spawned process to handle SIGINT event. An exception
handler (KeyboardInterrupt) is placed in the main program (but it
didn't catch the event).

I never encountered this problem before as spawned threads won't take
SIGINT event.

Is there any way I can force SIGINT event routing so that my main
process will get it?
Because of another requirement, I cannot swap main and spawned
process.

Any suggestions will be greatly appreciated.

Best regards,
Aki Niimura



More information about the Python-list mailing list