Skip to content

bpo-40010: Optimize pending calls in multithreaded applications #19091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2020
Merged

bpo-40010: Optimize pending calls in multithreaded applications #19091

merged 1 commit into from
Mar 20, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Mar 20, 2020

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.

https://bugs.python.org/issue40010

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.
@vstinner vstinner merged commit d831688 into python:master Mar 20, 2020
@vstinner vstinner deleted the eval_break_subinterp branch March 20, 2020 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants