mirror of
https://github.com/python/cpython.git
synced 2025-10-01 21:02:15 +00:00
Closes issue 12767: document the argument of threading.Condition.notify
This commit is contained in:
parent
667383c8d4
commit
3a8501e71f
1 changed files with 10 additions and 9 deletions
|
@ -573,20 +573,21 @@ needs to wake up one consumer thread.
|
||||||
interface is then used to restore the recursion level when the lock is
|
interface is then used to restore the recursion level when the lock is
|
||||||
reacquired.
|
reacquired.
|
||||||
|
|
||||||
.. method:: notify()
|
.. method:: notify(n=1)
|
||||||
|
|
||||||
Wake up a thread waiting on this condition, if any. If the calling thread
|
By default, wake up one thread waiting on this condition, if any. If the
|
||||||
has not acquired the lock when this method is called, a
|
calling thread has not acquired the lock when this method is called, a
|
||||||
:exc:`RuntimeError` is raised.
|
:exc:`RuntimeError` is raised.
|
||||||
|
|
||||||
This method wakes up one of the threads waiting for the condition
|
This method wakes up at most *n* of the threads waiting for the condition
|
||||||
variable, if any are waiting; it is a no-op if no threads are waiting.
|
variable; it is a no-op if no threads are waiting.
|
||||||
|
|
||||||
The current implementation wakes up exactly one thread, if any are
|
The current implementation wakes up exactly *n* threads, if at least *n*
|
||||||
waiting. However, it's not safe to rely on this behavior. A future,
|
threads are waiting. However, it's not safe to rely on this behavior.
|
||||||
optimized implementation may occasionally wake up more than one thread.
|
A future, optimized implementation may occasionally wake up more than
|
||||||
|
*n* threads.
|
||||||
|
|
||||||
Note: the awakened thread does not actually return from its :meth:`wait`
|
Note: an awakened thread does not actually return from its :meth:`wait`
|
||||||
call until it can reacquire the lock. Since :meth:`notify` does not
|
call until it can reacquire the lock. Since :meth:`notify` does not
|
||||||
release the lock, its caller should.
|
release the lock, its caller should.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue