-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
gh-97545: Make Semaphore run faster. #97549
Conversation
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.
I've run through this code so many times in my mind, this looks good to me. The silly speed test I wrote to flag this problem runs as fast as it used to. So I'll just merge this and backport to 3.11.
Thanks @cykerway for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
GH-97584 is a backport of this pull request to the 3.11 branch. |
(cherry picked from commit 68c46ae) Co-authored-by: Cyker Way <[email protected]>
Thanks @cykerway for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
GH-97585 is a backport of this pull request to the 3.10 branch. |
(cherry picked from commit 68c46ae) Co-authored-by: Cyker Way <[email protected]>
(cherry picked from commit 68c46ae) Co-authored-by: Cyker Way <[email protected]>
(cherry picked from commit 68c46ae) Co-authored-by: Cyker Way <[email protected]>
@@ -0,0 +1 @@ | |||
Make Semaphore run faster. |
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.
This is very vague and confusing as what Semaphore is made to run faster? threading
module or asyncio
?
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.
Sorry, that's a good point. It's asyncio.Semaphore. You should be able to create a PR that updates just that particular NEWS file. (And backport it.)
(cherry picked from commit 68c46ae) Co-authored-by: Cyker Way <[email protected]>
(cherry picked from commit 68c46ae) Co-authored-by: Cyker Way <[email protected]>
gh-97545: Make Semaphore run faster.
For this to be a fifo semaphore, the asyncio loop shall run tasks in their waking order (to be confirmed).
Background:
asyncio.Semaphore
and strengthen FIFO guarantee. #93222asyncio.{Lock,Semaphore}.locked()
return True when there are waiters? #97028Tests:
Lib/test/test_asyncio/test_locks.py