Visitar URL original
gh-89474: Improve Semaphore/BoundedSemaphore.release() for multiple thread waiting by corona10 · Pull Request #92447 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250613202406/https://github.com/python/cpython/pull/92447
Skip to content

gh-89474: Improve Semaphore/BoundedSemaphore.release() for multiple thread waiting #92447

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

Merged
merged 2 commits into from
May 8, 2022

Conversation

corona10
Copy link
Member

@corona10 corona10 commented May 8, 2022 •

closes: gh-89474

@corona10 corona10 changed the title Update Semaphore/BoundedSemaphore.release() to wake up at multiple th… gh-89474: Update Semaphore/BoundedSemaphore.release() to wake up at multiple th… May 8, 2022
@corona10 corona10 changed the title gh-89474: Update Semaphore/BoundedSemaphore.release() to wake up at multiple th… gh-89474: Improve Semaphore/BoundedSemaphore.release() for multiple thread waiting May 8, 2022
@corona10 corona10 force-pushed the gh-89474 branch 2 times, most recently from 9f3c875 to dfafe31 Compare May 8, 2022 06:22
@corona10
Copy link
Member Author

corona10 commented May 8, 2022 •

CI failure is due to following logs and other CI failures is not related to this PR.


Generated files not up to date.
Perhaps you forgot to run make regen-all or build.bat --regen. ;)
configure files must be regenerated with a specific version of autoconf.
M  configure

diff --git a/configure b/configure
index b57c6f3..e956de9 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for python 3.11.
+# Generated by GNU Autoconf 2.69 for python 3.12.
 #
 # Report bugs to <https://bugs.python.org/>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='python'
 PACKAGE_TARNAME='python'
-PACKAGE_VERSION='3.11'
-PACKAGE_STRING='python 3.11'
+PACKAGE_VERSION='3.12'
+PACKAGE_STRING='python 3.12'
 PACKAGE_BUGREPORT='https://bugs.python.org/'
 PACKAGE_URL=''

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test of the NEWS entry is not clear. What is the user-visible effect of this change?

@corona10
Copy link
Member Author

corona10 commented May 8, 2022

The test of the NEWS entry is not clear. What is the user-visible effect of this change?

cpython/Lib/threading.py

Lines 372 to 381 in e466faa

waiters_to_notify = _deque(_islice(all_waiters, n))
if not waiters_to_notify:
return
for waiter in waiters_to_notify:
waiter.release()
try:
all_waiters.remove(waiter)
except ValueError:
pass

I think that there might be no user-visible effect except slight performance improvement, I will remove the NEWS.d

@corona10
Copy link
Member Author

corona10 commented May 8, 2022

@serhiy-storchaka Rebased! PTAL :)

@corona10 corona10 merged commit c826867 into python:main May 8, 2022
@corona10 corona10 deleted the gh-89474 branch May 8, 2022 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Threading Semaphore and BoundedSemaphore release method implementation improvement
3 participants