[Python-checkins] r80861 - python/branches/signalfd-issue8407/Modules/signalmodule.c
jean-paul.calderone
python-checkins at python.org
Thu May 6 05:19:08 CEST 2010
Author: jean-paul.calderone
Date: Thu May 6 05:19:08 2010
New Revision: 80861
Log:
Use pthread_sigmask if it is available and not broken
Modified:
python/branches/signalfd-issue8407/Modules/signalmodule.c
Modified: python/branches/signalfd-issue8407/Modules/signalmodule.c
==============================================================================
--- python/branches/signalfd-issue8407/Modules/signalmodule.c (original)
+++ python/branches/signalfd-issue8407/Modules/signalmodule.c Thu May 6 05:19:08 2010
@@ -492,8 +492,13 @@
return 0;
}
+#if defined(HAVE_PTHREAD_SIGMASK) && !defined(HAVE_BROKEN_PTHREAD_SIGMASK)
+# define PY_SIGMASK pthread_sigmask
+#elif defined(HAVE_SIGPROCMASK)
+# define PY_SIGMASK sigprocmask
+#endif
-#ifdef HAVE_SIGPROCMASK
+#ifdef PY_SIGMASK
static PyObject *
signal_sigprocmask(PyObject *self, PyObject *args)
{
@@ -512,7 +517,7 @@
return NULL;
}
- if (sigprocmask(how, &mask, &previous) == -1) {
+ if (PY_SIGMASK(how, &mask, &previous) == -1) {
PyOS_snprintf(how_buffer, sizeof(how_buffer), how_format, how);
PyErr_SetString(PyExc_ValueError, how_buffer);
return NULL;
@@ -601,8 +606,10 @@
{"signal", signal_signal, METH_VARARGS, signal_doc},
{"getsignal", signal_getsignal, METH_VARARGS, getsignal_doc},
{"set_wakeup_fd", signal_set_wakeup_fd, METH_VARARGS, set_wakeup_fd_doc},
-#ifdef HAVE_SIGPROCMASK
+#ifdef PY_SIGMASK
{"sigprocmask", signal_sigprocmask, METH_VARARGS, sigprocmask_doc},
+/* It's no longer needed, so clean up the namespace. */
+#undef PY_SIGMASK
#endif
#ifdef HAVE_SIGNALFD
{"signalfd", signal_signalfd, METH_VARARGS, signalfd_doc},
More information about the Python-checkins
mailing list