merge forward from the python 2.x branch
diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst
index 7b40e8e..26d9320 100644
--- a/Doc/library/signal.rst
+++ b/Doc/library/signal.rst
@@ -13,9 +13,6 @@
underlying implementation), with the exception of the handler for
:const:`SIGCHLD`, which follows the underlying implementation.
-* There is no way to "block" signals temporarily from critical sections (since
- this is not supported by all Unix flavors).
-
* Although Python signal handlers are called asynchronously as far as the Python
user is concerned, they can only occur between the "atomic" instructions of the
Python interpreter. This means that signals arriving during long calculations
@@ -115,6 +112,46 @@
in user and kernel space. SIGPROF is delivered upon expiration.
+.. data:: SIG_BLOCK
+
+ A possible value for the *how* parameter to :func:`sigprocmask`
+ indicating that signals are to be blocked.
+
+ .. versionadded:: 2.7
+
+
+.. data:: SIG_UNBLOCK
+
+ A possible value for the *how* parameter to :func:`sigprocmask`
+ indicating that signals are to be unblocked.
+
+ .. versionadded:: 2.7
+
+
+.. data:: SIG_SETMASK
+
+ A possible value for the *how* parameter to :func:`sigprocmask`
+ indicating that the signal mask is to be replaced.
+
+ .. versionadded:: 2.7
+
+
+.. data:: SFD_CLOEXEC
+
+ A possible flag in the *flags* parameter to :func:`signalfd` which causes
+ the new file descriptor to be marked as close-on-exec.
+
+ .. versionadded:: 2.7
+
+
+.. data:: SFD_NONBLOCK
+
+ A possible flag in the *flags* parameter to :func:`signalfd` which causes
+ the new file description to be set non-blocking.
+
+ .. versionadded:: 2.7
+
+
The :mod:`signal` module defines one exception:
.. exception:: ItimerError
@@ -227,6 +264,44 @@
attribute descriptions in the :mod:`inspect` module).
+.. function:: signalfd(fd, mask[, flags])
+
+ Create a new file descriptor on which to receive signals or modify the
+ mask of such a file descriptor previously created by this function.
+ Availability: Linux (See the manpage :manpage:`signalfd(2)` for further
+ information).
+
+ If *fd* is ``-1``, a new file descriptor will be created. Otherwise,
+ *fd* must be a file descriptor previously returned by this function.
+
+ *mask* is a list of signal numbers which will trigger data on this file
+ descriptor.
+
+ *flags* is a bit mask which may include any :const:`signal.SFD_*` flag.
+
+ .. versionadded:: 2.7
+
+
+.. function:: sigprocmask(how, mask)
+
+ Set the signal mask for the process. The old signal mask is returned.
+ Availability: Unix (See the Unix man page :manpage:`sigprocmask(2)` and
+ :manpage:`pthread_sigmask(2)`.)
+
+ If *how* is :const:`signal.SIG_BLOCK`, the signals in the mask are added
+ to the set of blocked signals.
+
+ If *how* is :const:`signal.SIG_UNBLOCK`, the signals in the mask are
+ removed from the set of blocked signals.
+
+ If *how* is :const:`signal.SIG_SETMASK`, the signals in the mask are set
+ as blocked and the signals not in the mask are set as unblocked.
+
+ *mask* is a list of signal numbers (eg :const:`signal.SIGUSR1`).
+
+ .. versionadded:: 2.7
+
+
.. _signal-example:
Example