mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-10978: Semaphores can release multiple threads at a time (GH-15588)
This commit is contained in:
parent
0dac68f1e5
commit
35f6301d68
4 changed files with 56 additions and 13 deletions
|
@ -802,11 +802,14 @@ Semaphores also support the :ref:`context management protocol <with-locks>`.
|
|||
.. versionchanged:: 3.2
|
||||
The *timeout* parameter is new.
|
||||
|
||||
.. method:: release()
|
||||
.. method:: release(n=1)
|
||||
|
||||
Release a semaphore, incrementing the internal counter by one. When it
|
||||
was zero on entry and another thread is waiting for it to become larger
|
||||
than zero again, wake up that thread.
|
||||
Release a semaphore, incrementing the internal counter by *n*. When it
|
||||
was zero on entry and other threads are waiting for it to become larger
|
||||
than zero again, wake up *n* of those threads.
|
||||
|
||||
.. versionchanged:: 3.9
|
||||
Added the *n* parameter to release multiple waiting threads at once.
|
||||
|
||||
|
||||
.. class:: BoundedSemaphore(value=1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue