-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-125541: Make Ctrl-C interrupt threading.Lock.acquire()
on Windows
#125546
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
Conversation
Lockbench results are within the noise margin: Tools\lockbench\lockbench.pyBefore:
After:
|
Misc/NEWS.d/next/Library/2024-10-15-16-50-03.gh-issue-125541.FfhmWo.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'm not a Windows developer. Did you manually check that this works @colesbury ?
(I suspect it's not really possible to write an automated test for this?)
Yes, I manually tested on Windows with variations of the following script: import threading
import time
l1 = threading.Lock()
l2 = threading.Lock()
def thread_run():
l2.acquire()
l1.acquire()
t = threading.Thread(target=thread_run)
t.start()
time.sleep(0.1)
l1.acquire()
l2.acquire()
t.join() |
ctrl-c
interruptthreading.Lock.acquire()
on Windows #125541📚 Documentation preview 📚:
https://cpython-previews--125546.org.readthedocs.build/en/125546/library/threading.html
https://cpython-previews--125546.org.readthedocs.build/en/125546/library/_thread.html