Skip to content

Commit a66dcc7

Browse files
committed
Update threading.rst
1 parent 49ad4ae commit a66dcc7

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

Doc/library/threading.rst

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,45 @@
66

77
**Source code:** :source:`Lib/threading.py`
88

9+
This module constructs higher-level threading interfaces on top of the lower
10+
level :mod:`_thread` module.
11+
12+
.. versionchanged:: 3.7
13+
This module used to be optional, it is now always available.
14+
15+
.. seealso::
16+
17+
:class:`concurrent.futures.ThreadPoolExecutor` offers a higher level interface
18+
to push tasks to a background thread without blocking execution of the
19+
calling thread, while still being able to retrieve their results when needed.
20+
21+
:mod:`queue` provides a thread-safe interface for exchanging data between
22+
running threads.
23+
24+
:mod:`asyncio` offers an alternative approach to achieving task level
25+
concurrency without requiring the use of multiple operating system threads.
26+
27+
.. note::
28+
29+
In the Python 2.x series, this module contained ``camelCase`` names
30+
for some methods and functions. These are deprecated as of Python 3.10,
31+
but they are still supported for compatibility with Python 2.5 and lower.
32+
33+
34+
.. impl-detail::
35+
36+
In CPython, due to the :term:`Global Interpreter Lock
37+
<global interpreter lock>`, only one thread
38+
can execute Python code at once (even though certain performance-oriented
39+
libraries might overcome this limitation).
40+
If you want your application to make better use of the computational
41+
resources of multi-core machines, you are advised to use
42+
:mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`.
43+
However, threading is still an appropriate model if you want to run
44+
multiple I/O-bound tasks simultaneously.
45+
46+
.. include:: ../includes/wasm-notavail.rst
47+
948
--------------
1049

1150
Introduction
@@ -56,45 +95,6 @@ creating and starting threads using :class:`~threading.Thread`::
5695
for t in threads:
5796
t.join()
5897

59-
This module constructs higher-level threading interfaces on top of the lower
60-
level :mod:`_thread` module.
61-
62-
.. versionchanged:: 3.7
63-
This module used to be optional, it is now always available.
64-
65-
.. seealso::
66-
67-
:class:`concurrent.futures.ThreadPoolExecutor` offers a higher level interface
68-
to push tasks to a background thread without blocking execution of the
69-
calling thread, while still being able to retrieve their results when needed.
70-
71-
:mod:`queue` provides a thread-safe interface for exchanging data between
72-
running threads.
73-
74-
:mod:`asyncio` offers an alternative approach to achieving task level
75-
concurrency without requiring the use of multiple operating system threads.
76-
77-
.. note::
78-
79-
In the Python 2.x series, this module contained ``camelCase`` names
80-
for some methods and functions. These are deprecated as of Python 3.10,
81-
but they are still supported for compatibility with Python 2.5 and lower.
82-
83-
84-
.. impl-detail::
85-
86-
In CPython, due to the :term:`Global Interpreter Lock
87-
<global interpreter lock>`, only one thread
88-
can execute Python code at once (even though certain performance-oriented
89-
libraries might overcome this limitation).
90-
If you want your application to make better use of the computational
91-
resources of multi-core machines, you are advised to use
92-
:mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`.
93-
However, threading is still an appropriate model if you want to run
94-
multiple I/O-bound tasks simultaneously.
95-
96-
.. include:: ../includes/wasm-notavail.rst
97-
9898
This module defines the following functions:
9999

100100

0 commit comments

Comments
 (0)