You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make ctrl-c interrupt threading.Lock.acquire() on Windows #125541
Since Python 3.2, pressing ctrl-c (SIGINT) interrupts threading.Lock.acquire() on POSIX platforms, including Linux and macOS. However, this does not work on Windows.
Now that threading.Lock and threading.RLock use PyMutex and _PyRecursiveMutex internally, this should be a lot easier to implement efficiently.
Yes, we can use WaitForMultipleObjectsEx() with _PyOS_SigintEvent() there without performance implications because that is the slow path that's only taken if the thread is about to block.
Activity
pitrou commentedon Oct 15, 2024
You mean here
cpython/Python/parking_lot.c
Line 114 in aac89b5
colesbury commentedon Oct 15, 2024
Yes, we can use
WaitForMultipleObjectsEx()with_PyOS_SigintEvent()there without performance implications because that is the slow path that's only taken if the thread is about to block.pythongh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on …
pythongh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on …
pythongh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on …
pythongh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on …
pythongh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on …
pythongh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on …
pythongh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on …
gh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on Windows (
pythongh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on …