summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/signal.rst7
-rw-r--r--Doc/library/threading.rst19
2 files changed, 18 insertions, 8 deletions
diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst
index 68a5d2c..f2a37cc 100644
--- a/Doc/library/signal.rst
+++ b/Doc/library/signal.rst
@@ -187,10 +187,9 @@ The :mod:`signal` module defines the following functions:
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.
+ Use :func:`threading.get_ident()` or the :attr:`~threading.Thread.ident`
+ attribute of :attr:`threading.Thread` to get a 'thread identifier' for
+ *thread_id*.
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.
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
index df47045..504a2fb 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -48,6 +48,17 @@ This module defines the following functions and objects:
returned.
+.. function:: get_ident()
+
+ Return the 'thread identifier' of the current thread. This is a nonzero
+ integer. Its value has no direct meaning; it is intended as a magic cookie
+ to be used e.g. to index a dictionary of thread-specific data. Thread
+ identifiers may be recycled when a thread exits and another thread is
+ created.
+
+ .. versionadded:: 3.3
+
+
.. function:: enumerate()
Return a list of all :class:`Thread` objects currently alive. The list
@@ -332,10 +343,10 @@ impossible to detect the termination of alien threads.
.. attribute:: ident
The 'thread identifier' of this thread or ``None`` if the thread has not
- been started. This is a nonzero integer. See the
- :func:`thread.get_ident()` function. Thread identifiers may be recycled
- when a thread exits and another thread is created. The identifier is
- available even after the thread has exited.
+ been started. This is a nonzero integer. See the :func:`get_ident()`
+ function. Thread identifiers may be recycled when a thread exits and
+ another thread is created. The identifier is available even after the
+ thread has exited.
.. method:: is_alive()