mirror of https://github.com/python/cpython
update the threading docs to account for recent changes
This commit is contained in:
parent
6ee1a31e9b
commit
facdd6ee9e
|
@ -14,8 +14,11 @@ The :mod:`dummy_threading` module is provided for situations where
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
In 3.x, names in ``camelCase`` have been renamed to their underscored
|
Some name ``camelCase`` names have been converted to their underscored
|
||||||
equivalents. Both names are available in 2.6.
|
equivalents. Others have been replaced by properties. Using the old methods
|
||||||
|
in 2.6 will trigger a :exc:`DeprecationWarning` when Python is run with the
|
||||||
|
:option:`-3` flag and a full :exc:`DeprecationWarning` in 3.0. The old names
|
||||||
|
will be removed early in the 3.x series.
|
||||||
|
|
||||||
This module defines the following functions and objects:
|
This module defines the following functions and objects:
|
||||||
|
|
||||||
|
@ -553,19 +556,19 @@ separate thread of control.
|
||||||
|
|
||||||
Once the thread's activity is started, the thread is considered 'alive'. It
|
Once the thread's activity is started, the thread is considered 'alive'. It
|
||||||
stops being alive when its :meth:`run` method terminates -- either normally, or
|
stops being alive when its :meth:`run` method terminates -- either normally, or
|
||||||
by raising an unhandled exception. The :meth:`isAlive` method tests whether the
|
by raising an unhandled exception. The :meth:`is_alive` method tests whether the
|
||||||
thread is alive.
|
thread is alive.
|
||||||
|
|
||||||
Other threads can call a thread's :meth:`join` method. This blocks the calling
|
Other threads can call a thread's :meth:`join` method. This blocks the calling
|
||||||
thread until the thread whose :meth:`join` method is called is terminated.
|
thread until the thread whose :meth:`join` method is called is terminated.
|
||||||
|
|
||||||
A thread has a name. The name can be passed to the constructor, set with the
|
A thread has a name. The name can be passed to the constructor, and read or
|
||||||
:meth:`set_name` method, and retrieved with the :meth:`get_name` method.
|
changed through the :attr:`name` attribute.
|
||||||
|
|
||||||
A thread can be flagged as a "daemon thread". The significance of this flag is
|
A thread can be flagged as a "daemon thread". The significance of this flag is
|
||||||
that the entire Python program exits when only daemon threads are left. The
|
that the entire Python program exits when only daemon threads are left. The
|
||||||
initial value is inherited from the creating thread. The flag can be set with
|
initial value is inherited from the creating thread. The flag can be set
|
||||||
the :meth:`set_daemon` method and retrieved with the :meth:`is_daemon` method.
|
through the :attr:`daemon` attribute.
|
||||||
|
|
||||||
There is a "main thread" object; this corresponds to the initial thread of
|
There is a "main thread" object; this corresponds to the initial thread of
|
||||||
control in the Python program. It is not a daemon thread.
|
control in the Python program. It is not a daemon thread.
|
||||||
|
@ -645,18 +648,15 @@ impossible to detect the termination of alien threads.
|
||||||
raises the same exception.
|
raises the same exception.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Thread.get_name()
|
.. method:: Thread.getName()
|
||||||
Thread.getName()
|
Thread.setName()
|
||||||
|
|
||||||
Return the thread's name.
|
Old API for :attr:`~Thread.name`.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Thread.set_name(name)
|
.. attribute:: Thread.name
|
||||||
Thread.setName(name)
|
|
||||||
|
|
||||||
Set the thread's name.
|
A string used for identification purposes only. It has no semantics.
|
||||||
|
|
||||||
The name is a string used for identification purposes only. It has no semantics.
|
|
||||||
Multiple threads may be given the same name. The initial name is set by the
|
Multiple threads may be given the same name. The initial name is set by the
|
||||||
constructor.
|
constructor.
|
||||||
|
|
||||||
|
@ -682,17 +682,16 @@ impossible to detect the termination of alien threads.
|
||||||
returns a list of all alive threads.
|
returns a list of all alive threads.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Thread.is_daemon()
|
.. method:: Thread.isDaemon()
|
||||||
Thread.isDaemon()
|
Thread.setDaemon()
|
||||||
|
|
||||||
Return the thread's daemon flag.
|
Old API for :attr:`~Thread.daemon`.
|
||||||
|
|
||||||
|
|
||||||
.. method:: Thread.set_daemon(daemonic)
|
.. attribute:: Thread.daemon
|
||||||
Thread.setDaemon(daemonic)
|
|
||||||
|
|
||||||
Set the thread's daemon flag to the Boolean value *daemonic*. This must be
|
The thread's daemon flag. This must be set before :meth:`start` is called,
|
||||||
called before :meth:`start` is called, otherwise :exc:`RuntimeError` is raised.
|
otherwise :exc:`RuntimeError` is raised.
|
||||||
|
|
||||||
The initial value is inherited from the creating thread.
|
The initial value is inherited from the creating thread.
|
||||||
|
|
||||||
|
|
|
@ -669,7 +669,8 @@ Library
|
||||||
- The bundled OSX-specific copy of libbffi is now in sync with the version
|
- The bundled OSX-specific copy of libbffi is now in sync with the version
|
||||||
shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms.
|
shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms.
|
||||||
|
|
||||||
- The threading module gained alias for names that are removed in 3.x.
|
- The threading module gained alias for names that will be removed in the 3.x
|
||||||
|
series.
|
||||||
|
|
||||||
Build
|
Build
|
||||||
-----
|
-----
|
||||||
|
|
Loading…
Reference in New Issue