summaryrefslogtreecommitdiffstats
path: root/Modules/signalmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-08 00:03:15 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-08 00:03:15 (GMT)
commitd49b1f14de90ce31bb0777ac232c0ee1ec5ed6ce (patch)
treea201ad26f808cf4d1cefa8f57fe397e88d1afc77 /Modules/signalmodule.c
parentb3e7219abfdb52321b7e8f1f57499ece23a7d2f8 (diff)
downloadcpython-d49b1f14de90ce31bb0777ac232c0ee1ec5ed6ce.zip
cpython-d49b1f14de90ce31bb0777ac232c0ee1ec5ed6ce.tar.gz
cpython-d49b1f14de90ce31bb0777ac232c0ee1ec5ed6ce.tar.bz2
Issue #8407: The signal handler writes the signal number as a single byte
instead of a nul byte into the wakeup file descriptor. So it is possible to wait more than one signal and know which signals were raised.
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r--Modules/signalmodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 7285079..7e07b3e 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -176,6 +176,7 @@ checksignals_witharg(void * unused)
static void
trip_signal(int sig_num)
{
+ unsigned char byte;
Handlers[sig_num].tripped = 1;
if (is_tripped)
return;
@@ -183,8 +184,10 @@ trip_signal(int sig_num)
cleared in PyErr_CheckSignals() before .tripped. */
is_tripped = 1;
Py_AddPendingCall(checksignals_witharg, NULL);
- if (wakeup_fd != -1)
- write(wakeup_fd, "\0", 1);
+ if (wakeup_fd != -1) {
+ byte = (unsigned char)sig_num;
+ write(wakeup_fd, &byte, 1);
+ }
}
static void