diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-07 23:46:11 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-07 23:46:11 (GMT) |
commit | b3e7219abfdb52321b7e8f1f57499ece23a7d2f8 (patch) | |
tree | 59c85547d493099af2365d7ccf48245d501b11b0 /Doc | |
parent | 2c736bb38ec6089f5360e6a7f2f76a70fb869352 (diff) | |
download | cpython-b3e7219abfdb52321b7e8f1f57499ece23a7d2f8.zip cpython-b3e7219abfdb52321b7e8f1f57499ece23a7d2f8.tar.gz cpython-b3e7219abfdb52321b7e8f1f57499ece23a7d2f8.tar.bz2 |
Issue #8407: Add pthread_kill(), sigpending() and sigwait() functions to the
signal module.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/os.rst | 2 | ||||
-rw-r--r-- | Doc/library/signal.rst | 53 | ||||
-rw-r--r-- | Doc/whatsnew/3.3.rst | 9 |
3 files changed, 61 insertions, 3 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst index eca51dc..7609580 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2284,6 +2284,8 @@ written in Python, such as a mail server's external command delivery program. will be set to *sig*. The Windows version of :func:`kill` additionally takes process handles to be killed. + See also :func:`signal.pthread_kill`. + .. versionadded:: 3.2 Windows support. diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst index f318cfa..473eda2 100644 --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -179,6 +179,29 @@ 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`. + + +.. function:: pthread_kill(thread_id, signum) + + Send the signal *signum* to the thread *thread_id*, another thread in the same + process as the caller. The signal is asynchronously directed to thread. + + *thread_id* can be read from the :attr:`~threading.Thread.ident` attribute + of :attr:`threading.Thread`. For example, + ``threading.current_thread().ident`` gives the identifier of the current + thread. + + If *signum* is 0, then no signal is sent, but error checking is still + performed; this can be used to check if a thread is still running. + + Availability: Unix (see the man page :manpage:`pthread_kill(3)` for further + information). + + See also :func:`os.kill`. + + .. versionadded:: 3.3 + .. function:: pthread_sigmask(how, mask) @@ -206,6 +229,8 @@ The :mod:`signal` module defines the following functions: Availability: Unix. See the man page :manpage:`sigprocmask(3)` and :manpage:`pthread_sigmask(3)` for further information. + See also :func:`pause`, :func:`sigpending` and :func:`sigwait`. + .. versionadded:: 3.3 @@ -283,6 +308,34 @@ The :mod:`signal` module defines the following functions: :const:`SIGTERM`. A :exc:`ValueError` will be raised in any other case. +.. function:: sigpending() + + Examine the set of signals that are pending for delivery to the calling + thread (i.e., the signals which have been raised while blocked). Return the + set of the pending signals. + + Availability: Unix (see the man page :manpage:`sigpending(2)` for further + information). + + See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`. + + .. versionadded:: 3.3 + + +.. function:: sigwait(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 + (removes it from the pending list of signals), and returns the signal number. + + Availability: Unix (see the man page :manpage:`sigwait(3)` for further + information). + + See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigpending`. + + .. versionadded:: 3.3 + + .. _signal-example: Example diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst index 0ab4fc8..14f06af 100644 --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -123,10 +123,13 @@ sys signal ------ -* The :mod:`signal` module has a new :func:`~signal.pthread_sigmask` function - to fetch and/or change the signal mask of the calling thread. +* The :mod:`signal` module has a new functions: - (Contributed by Jean-Paul Calderone in :issue:`8407`) + * :func:`~signal.pthread_sigmask`: fetch and/or change the signal mask of the + calling thread (Contributed by Jean-Paul Calderone in :issue:`8407`) ; + * :func:`~signal.pthread_kill`: send a signal to a thread ; + * :func:`~signal.sigpending`: examine pending functions ; + * :func:`~signal.sigwait`: wait a signal. Optimizations |