summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2011-06-25 10:13:40 (GMT)
committerRoss Lagerwall <rosslagerwall@gmail.com>2011-06-25 10:13:40 (GMT)
commitbc808224b6fb6f829df4bf6bb04d3a64f6e4ddcb (patch)
tree79b866b9eb1793f8d6321d46c3c642adfa1e00ca /Doc
parentbb66972c0b263278b6468e59a240af5c7b771966 (diff)
downloadcpython-bc808224b6fb6f829df4bf6bb04d3a64f6e4ddcb.zip
cpython-bc808224b6fb6f829df4bf6bb04d3a64f6e4ddcb.tar.gz
cpython-bc808224b6fb6f829df4bf6bb04d3a64f6e4ddcb.tar.bz2
Issue #12303: Add sigwaitinfo() and sigtimedwait() to the signal module.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/signal.rst45
-rw-r--r--Doc/whatsnew/3.3.rst4
2 files changed, 47 insertions, 2 deletions
diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst
index f2a37cc..9bca72e 100644
--- a/Doc/library/signal.rst
+++ b/Doc/library/signal.rst
@@ -179,7 +179,8 @@ The :mod:`signal` module defines the following functions:
will then be called. Returns nothing. Not on Windows. (See the Unix man page
:manpage:`signal(2)`.)
- See also :func:`sigwait` and :func:`sigpending`.
+ See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and
+ :func:`sigpending`.
.. function:: pthread_kill(thread_id, signum)
@@ -334,7 +335,47 @@ The :mod:`signal` module defines the following functions:
Availability: Unix (see the man page :manpage:`sigwait(3)` for further
information).
- See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigpending`.
+ See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`,
+ :func:`sigwaitinfo` and :func:`sigtimedwait`.
+
+ .. versionadded:: 3.3
+
+
+.. function:: sigwaitinfo(sigset)
+
+ Suspend execution of the calling thread until the delivery of one of the
+ signals specified in the signal set *sigset*. The function accepts the
+ signal and removes it from the pending list of signals. If one of the
+ signals in *sigset* is already pending for the calling thread, the function
+ will return immediately with information about that signal. The signal
+ handler is not called for the delivered signal. The function raises an
+ :exc:`OSError` with error number set to :const:`errno.EINTR` if it is
+ interrupted by a signal that is not in *sigset*.
+
+ The return value is an object representing the data contained in the
+ :c:type:`siginfo_t` structure, namely: :attr:`si_signo`, :attr:`si_code`,
+ :attr:`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`,
+ :attr:`si_band`.
+
+ Availability: Unix (see the man page :manpage:`sigwaitinfo(2)` for further
+ information).
+
+ See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`.
+
+ .. versionadded:: 3.3
+
+
+.. function:: sigtimedwait(sigset, (timeout_sec, timeout_nsec))
+
+ Like :func:`sigtimedwait`, but takes a tuple of ``(seconds, nanoseconds)``
+ as an additional argument specifying a timeout. If both *timeout_sec* and
+ *timeout_nsec* are specified as :const:`0`, a poll is performed. Returns
+ :const:`None` if a timeout occurs.
+
+ Availability: Unix (see the man page :manpage:`sigtimedwait(2)` for further
+ information).
+
+ See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`.
.. versionadded:: 3.3
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
index e1d1cb4..4374d02 100644
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -169,6 +169,10 @@ signal
* :func:`~signal.pthread_kill`: send a signal to a thread ;
* :func:`~signal.sigpending`: examine pending functions ;
* :func:`~signal.sigwait`: wait a signal.
+ * :func:`~signal.sigwaitinfo`: wait for a signal, returning detailed
+ information about it.
+ * :func:`~signal.sigtimedwait`: like :func:`~signal.sigwaitinfo` but with a
+ timeout.
* 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