diff options
author | Christian Heimes <christian@cheimes.de> | 2013-08-18 01:16:16 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-08-18 01:16:16 (GMT) |
commit | 17dd53b4645c4684e8b662e937fe0f7cd3b45088 (patch) | |
tree | 313ccf43fed6fc3cbfe3813cd9a4ec65a0033a14 /Modules | |
parent | 5bb2c8668d7dce169cc0f22ede964cb226bb3d5f (diff) | |
parent | 8f0bddad308f8c52bf16e3f90a864b2a168e3291 (diff) | |
download | cpython-17dd53b4645c4684e8b662e937fe0f7cd3b45088.zip cpython-17dd53b4645c4684e8b662e937fe0f7cd3b45088.tar.gz cpython-17dd53b4645c4684e8b662e937fe0f7cd3b45088.tar.bz2 |
merge
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/signalmodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 0810633..bc99f23 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -175,15 +175,31 @@ checksignals_witharg(void * unused) return PyErr_CheckSignals(); } +static int +report_wakeup_error(void *data) +{ + int save_errno = errno; + errno = (int) (Py_intptr_t) data; + PyErr_SetFromErrno(PyExc_OSError); + PySys_WriteStderr("Exception ignored when trying to write to the " + "signal wakeup fd:\n"); + PyErr_WriteUnraisable(NULL); + errno = save_errno; + return 0; +} + static void trip_signal(int sig_num) { unsigned char byte; + int rc = 0; Handlers[sig_num].tripped = 1; if (wakeup_fd != -1) { byte = (unsigned char)sig_num; - write(wakeup_fd, &byte, 1); + while ((rc = write(wakeup_fd, &byte, 1)) == -1 && errno == EINTR); + if (rc == -1) + Py_AddPendingCall(report_wakeup_error, (void *) (Py_intptr_t) errno); } if (is_tripped) return; |