[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

Charles-François Natali report at bugs.python.org
Thu Jun 9 19:17:21 CEST 2011


Charles-François Natali <neologix at free.fr> added the comment:

I just noticed something "funny": signal_sigwait doesn't release the
GIL, which means that it's pretty much useless :-)
Patch attached.
Also, test_sigwait doesn't block the signal before calling sigwait: it
happens to work because there's only one thread, but it's undefined
behaviour.

----------
Added file: http://bugs.python.org/file22300/sigwait_gil.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8407>
_______________________________________
-------------- next part --------------
--- cpython-302424b84b07/Modules/signalmodule.c	2011-06-01 02:39:38.000000000 +0000
+++ cpython/Modules/signalmodule.c	2011-06-09 11:39:28.000000000 +0000
@@ -662,7 +662,9 @@
     if (iterable_to_sigset(signals, &set))
         return NULL;
 
+    Py_BEGIN_ALLOW_THREADS
     err = sigwait(&set, &signum);
+    Py_END_ALLOW_THREADS
     if (err) {
         errno = err;
         return PyErr_SetFromErrno(PyExc_OSError);


More information about the Python-bugs-list mailing list