]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-135099: Only wait on `_PyOS_SigintEvent()` in main thread (GH-135100) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 4 Jun 2025 12:44:35 +0000 (14:44 +0200)
committerGitHub <noreply@github.com>
Wed, 4 Jun 2025 12:44:35 +0000 (08:44 -0400)
commitb2b9aaa93d054a3315dd3d0f5d3b1193d65be3d5
tree2fa85972243c3c9d09a440842c8bb960e82947a5
parentf5b438517d6618efa674470b3e2e2421334d2dc3
[3.14] gh-135099: Only wait on `_PyOS_SigintEvent()` in main thread (GH-135100) (GH-135116)

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.
(cherry picked from commit cc581f32bf5f15e9f2f89b830ec64ea25684d0cd)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Misc/NEWS.d/next/Windows/2025-06-03-18-26-54.gh-issue-135099.Q9usKm.rst [new file with mode: 0644]
Python/parking_lot.c