]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43293: Doc: move note about GIL to top of threading module (GH-24622)
authorGuanzhong Chen <quantum2048@gmail.com>
Wed, 24 Feb 2021 18:39:38 +0000 (13:39 -0500)
committerGitHub <noreply@github.com>
Wed, 24 Feb 2021 18:39:38 +0000 (18:39 +0000)
The note about the GIL was buried pretty deep in the threading documentation,
and this made it hard for first time users to discover why their attempts
at using threading to parallelizing their application did not work.

In this commit, the note is moved to the top of the module documention for
visibility.

Doc/library/threading.rst

index 690735469d0bf688ba4c85c18bebc3b2ce314669..bb982f2edcf1b29dfc14cca0002a0f04bc2b0196 100644 (file)
@@ -21,6 +21,19 @@ level :mod:`_thread` module.  See also the :mod:`queue` module.
    supported by this module.
 
 
+.. impl-detail::
+
+   In CPython, due to the :term:`Global Interpreter Lock
+   <global interpreter lock>`, only one thread
+   can execute Python code at once (even though certain performance-oriented
+   libraries might overcome this limitation).
+   If you want your application to make better use of the computational
+   resources of multi-core machines, you are advised to use
+   :mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`.
+   However, threading is still an appropriate model if you want to run
+   multiple I/O-bound tasks simultaneously.
+
+
 This module defines the following functions:
 
 
@@ -424,19 +437,6 @@ since it is impossible to detect the termination of alien threads.
       property instead.
 
 
-.. impl-detail::
-
-   In CPython, due to the :term:`Global Interpreter Lock
-   <global interpreter lock>`, only one thread
-   can execute Python code at once (even though certain performance-oriented
-   libraries might overcome this limitation).
-   If you want your application to make better use of the computational
-   resources of multi-core machines, you are advised to use
-   :mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`.
-   However, threading is still an appropriate model if you want to run
-   multiple I/O-bound tasks simultaneously.
-
-
 .. _lock-objects:
 
 Lock Objects