]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-135099: Only wait on `_PyOS_SigintEvent()` in main thread (GH-135100)
authorSam Gross <colesbury@gmail.com>
Wed, 4 Jun 2025 07:35:56 +0000 (03:35 -0400)
committerGitHub <noreply@github.com>
Wed, 4 Jun 2025 07:35:56 +0000 (09:35 +0200)
commitcc581f32bf5f15e9f2f89b830ec64ea25684d0cd
treeb402a981e67b55f46bab4a34900837a262da54fb
parent8f778f7bb9a8ad80fc06570566ad4de541826178
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.
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