Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2515c4d

Browse files
committed
Merge heads
2 parents c153cd3 + d44af82 commit 2515c4d

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

Doc/library/threading.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -634,20 +634,21 @@ the call as often as necessary.
634634

635635
.. versionadded:: 3.2
636636

637-
.. method:: notify()
637+
.. method:: notify(n=1)
638638

639-
Wake up a thread waiting on this condition, if any. If the calling thread
640-
has not acquired the lock when this method is called, a
639+
By default, wake up one thread waiting on this condition, if any. If the
640+
calling thread has not acquired the lock when this method is called, a
641641
:exc:`RuntimeError` is raised.
642642

643-
This method wakes up one of the threads waiting for the condition
644-
variable, if any are waiting; it is a no-op if no threads are waiting.
643+
This method wakes up at most *n* of the threads waiting for the condition
644+
variable; it is a no-op if no threads are waiting.
645645

646-
The current implementation wakes up exactly one thread, if any are
647-
waiting. However, it's not safe to rely on this behavior. A future,
648-
optimized implementation may occasionally wake up more than one thread.
646+
The current implementation wakes up exactly *n* threads, if at least *n*
647+
threads are waiting. However, it's not safe to rely on this behavior.
648+
A future, optimized implementation may occasionally wake up more than
649+
*n* threads.
649650

650-
Note: the awakened thread does not actually return from its :meth:`wait`
651+
Note: an awakened thread does not actually return from its :meth:`wait`
651652
call until it can reacquire the lock. Since :meth:`notify` does not
652653
release the lock, its caller should.
653654

0 commit comments

Comments
 (0)