[issue1975] signals not always delivered to main thread, since other threads have the signal unmasked
nh2
report at bugs.python.org
Mon Nov 22 16:32:47 CET 2010
nh2 <nh2 at deditus.de> added the comment:
My problem was actually related to the subprocess.Popen I use inside my threads in combination with signals. As Popen does not spawn a new thread, but a new process, it completely ignores my locks.
However, it seems impossible to safely unregister signals for subprocesses. I tried using SIG_IGN in preexec_fn for Popen as well as a ignore/Popen/unignore wrapper, but both result in race conditions (for the first: if the signal arrives between fork and exec and for the second if it arrives within the wrapper).
I think ignoring signals by default for everything but the main thread or process would solve this problem and make parallel programming with events in Python a lot easier.
Explicit is better than implicit.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1975>
_______________________________________
More information about the Python-bugs-list
mailing list