]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40010: Optimize signal handling in multithreaded applications (GH-19067)
authorVictor Stinner <vstinner@python.org>
Thu, 19 Mar 2020 16:40:12 +0000 (17:40 +0100)
committerGitHub <noreply@github.com>
Thu, 19 Mar 2020 16:40:12 +0000 (17:40 +0100)
commit5a3a71dddbe80edc75a3a74ce3b7978cf8635901
tree952adf6d4c06bc9d8af4fcca28a7e652050d25af
parent77248a28896d39cae0a7e084965b9ffc2624b7f4
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.
Doc/whatsnew/3.9.rst
Misc/NEWS.d/next/Core and Builtins/2020-03-19-02-26-13.bpo-40010.Y-LIR0.rst [new file with mode: 0644]
Python/ceval.c
Python/ceval_gil.h