SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

0 0 1 Python

gh-135099: Only wait on `_PyOS_SigintEvent()` in main thread (GH-135100)

On Windows, the `_PyOS_SigintEvent()` event handle is used to interrupt
the main thread when Ctrl-C is pressed. Previously, we also waited on
the event from other threads, but ignored the result. However, this can
race with interpreter shutdown because the main thread closes the handle
in `_PySignal_Fini` and threads may still be running and using mutexes
during interpreter shtudown.

Only use `_PyOS_SigintEvent()` in the main thread in parking_lot.c, like
we do in other places in the CPython codebase.
S
Sam Gross committed
cc581f32bf5f15e9f2f89b830ec64ea25684d0cd
Parent: 8f778f7
Committed by GitHub <noreply@github.com> on 6/4/2025, 7:35:56 AM