gh-125541: Make Ctrl-C interrupt threading.Lock.acquire() on Windows#125546
Merged
pitrou merged 4 commits intopython:mainfrom Oct 17, 2024
Merged
gh-125541: Make Ctrl-C interrupt threading.Lock.acquire() on Windows#125546pitrou merged 4 commits intopython:mainfrom
threading.Lock.acquire() on Windows#125546pitrou merged 4 commits intopython:mainfrom
Conversation
Contributor
Author
|
Lockbench results are within the noise margin: Tools\lockbench\lockbench.pyBefore: After: |
pitrou
reviewed
Oct 15, 2024
Misc/NEWS.d/next/Library/2024-10-15-16-50-03.gh-issue-125541.FfhmWo.rst
Outdated
Show resolved
Hide resolved
pitrou
approved these changes
Oct 17, 2024
Member
pitrou
left a comment
There was a problem hiding this comment.
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?)
Contributor
Author
|
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ctrl-cinterruptthreading.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