[issue8407] expose signalfd(2) and sigprocmask(2) in the signal module
report at bugs.python.org
Fri Apr 16 15:52:32 CEST 2010
Jean-Paul Calderone <exarkun at twistedmatrix.com> added the comment:
> The one big difference I can see is that set_wakeup_fd() doesn't transmit the signal number, but this could be fixed if desired (instead of sending '\0', send a byte containing the signal number).
There's a lot more information than the signal number available as well. The signalfd_siginfo struct has 16 fields in it now and may have more in the future.
Another advantage is that this approach allows all asynchronous preemption to be disabled. This side-steps the possibility of hitting any signal bugs in CPython itself. Of course, any such bugs that are found should be fixed, but fixing them is often quite challenging and involves lots of complex domain-specific knowledge. In comparison, the signalfd and sigprocmask extensions are quite straight-forward and self-contained.
It's also possible to have several signalfds, each with a different signal mask. set_wakeup_fd is limited to a single fd per-process.
sigprocmask has other uses all by itself, of course, like delaying the delivery of signals while some sensitive code runs.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list