]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40010: Optimize pending calls in multithreaded applications (GH-19091)
authorVictor Stinner <vstinner@python.org>
Fri, 20 Mar 2020 13:50:35 +0000 (14:50 +0100)
committerGitHub <noreply@github.com>
Fri, 20 Mar 2020 13:50:35 +0000 (14:50 +0100)
commitd83168854e19d0381fa57db25fca6c622917624f
treeb282c1b565d7ad97f789683dac78c2dfc767027f
parentd2a8e5b42c5e9c4e745a0589043a8aebb49f8ca2
bpo-40010: Optimize pending calls in multithreaded applications (GH-19091)

If a thread different than the main thread schedules a pending call
(Py_AddPendingCall()), the bytecode evaluation loop is no longer
interrupted at each bytecode instruction to check for pending calls
which cannot be executed. Only the main thread can execute pending
calls.

Previously, the bytecode evaluation loop was interrupted at each
instruction until the main thread executes pending calls.

* Add _Py_ThreadCanHandlePendingCalls() function.
* SIGNAL_PENDING_CALLS() now only sets eval_breaker to 1 if the
  current thread can execute pending calls. Only the main thread can
  execute pending calls.
Include/internal/pycore_pystate.h
Misc/NEWS.d/next/Core and Builtins/2020-03-20-13-51-55.bpo-40010.QGf5s8.rst [new file with mode: 0644]
Python/ceval.c