summaryrefslogtreecommitdiffstats
path: root/Doc/library/signal.rst
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 /Doc/library/signal.rst
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 'Doc/library/signal.rst')
-rw-r--r--Doc/library/signal.rst10
1 files changed, 7 insertions, 3 deletions
diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst
index 473eda2..68a5d2c 100644
--- a/Doc/library/signal.rst
+++ b/Doc/library/signal.rst
@@ -262,13 +262,17 @@ The :mod:`signal` module defines the following functions:
.. function:: set_wakeup_fd(fd)
- Set the wakeup fd to *fd*. When a signal is received, a ``'\0'`` byte is
- written to the fd. This can be used by a library to wakeup a poll or select
- call, allowing the signal to be fully processed.
+ Set the wakeup file descriptor to *fd*. When a signal is received, the
+ signal number is written as a single byte into the fd. This can be used by
+ a library to wakeup a poll or select call, allowing the signal to be fully
+ processed.
The old wakeup fd is returned. *fd* must be non-blocking. It is up to the
library to remove any bytes before calling poll or select again.
+ Use for example ``struct.unpack('%uB' % len(data), data)`` to decode the
+ signal numbers list.
+
When threads are enabled, this function can only be called from the main thread;
attempting to call it from other threads will cause a :exc:`ValueError`
exception to be raised.