diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-19 16:40:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 16:40:12 (GMT) |
commit | 5a3a71dddbe80edc75a3a74ce3b7978cf8635901 (patch) | |
tree | 952adf6d4c06bc9d8af4fcca28a7e652050d25af /Doc | |
parent | 77248a28896d39cae0a7e084965b9ffc2624b7f4 (diff) | |
download | cpython-5a3a71dddbe80edc75a3a74ce3b7978cf8635901.zip cpython-5a3a71dddbe80edc75a3a74ce3b7978cf8635901.tar.gz cpython-5a3a71dddbe80edc75a3a74ce3b7978cf8635901.tar.bz2 |
bpo-40010: Optimize signal handling in multithreaded applications (GH-19067)
If a thread different than the main thread gets a signal, the
bytecode evaluation loop is no longer interrupted at each bytecode
instruction to check for pending signals which cannot be handled.
Only the main thread of the main interpreter can handle signals.
Previously, the bytecode evaluation loop was interrupted at each
instruction until the main thread handles signals.
Changes:
* COMPUTE_EVAL_BREAKER() and SIGNAL_PENDING_SIGNALS() no longer set
eval_breaker to 1 if the current thread cannot handle signals.
* take_gil() now always recomputes eval_breaker.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/3.9.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 5e8cdf5..ac5d317 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -411,6 +411,16 @@ Optimizations (Contributed by Serhiy Storchaka in :issue:`32856`.) +* Optimize signal handling in multithreaded applications. If a thread different + than the main thread gets a signal, the bytecode evaluation loop is no longer + interrupted at each bytecode instruction to check for pending signals which + cannot be handled. Only the main thread of the main interpreter can handle + signals. + + Previously, the bytecode evaluation loop was interrupted at each instruction + until the main thread handles signals. + (Contributed by Victor Stinner in :issue:`40010`.) + Build and C API Changes ======================= |