mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Close #12028: Make threading._get_ident() public, rename it to
threading.get_ident() and document it. This function was used by _thread.get_ident().
This commit is contained in:
parent
d976098e3b
commit
2a12974bca
12 changed files with 50 additions and 39 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue