diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-02-24 18:49:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 18:49:19 (GMT) |
commit | 2a9e6ab6adc82713e43cdf0aed09557d0d63e3bb (patch) | |
tree | 8f2131597349088d2cc63c42f5c6cbb02621ad68 /Doc/library | |
parent | 653e17b2cb35e6cd48e2bdca0c1b27b38bed7170 (diff) | |
download | cpython-2a9e6ab6adc82713e43cdf0aed09557d0d63e3bb.zip cpython-2a9e6ab6adc82713e43cdf0aed09557d0d63e3bb.tar.gz cpython-2a9e6ab6adc82713e43cdf0aed09557d0d63e3bb.tar.bz2 |
bpo-43293: Doc: move note about GIL to top of threading module (GH-24622)
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.
(cherry picked from commit 32181be6081f6c70a1e0bd0540050805c8e88e83)
Co-authored-by: Guanzhong Chen <quantum2048@gmail.com>
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/threading.rst | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 4c78e6e..235d5d3 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -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: @@ -393,19 +406,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 |