[Python-checkins] cpython (merge 3.2 -> default): Issue 12767: document the argument of threading.Condition.notify

eli.bendersky python-checkins at python.org
Sat Nov 12 19:36:53 CET 2011


http://hg.python.org/cpython/rev/ac12dcea69e1
changeset: 73522:ac12dcea69e1
parent: 73520:e3a84fa5cf63
parent: 73521:63a24bff6f36
user: Eli Bendersky <eliben at gmail.com>
date: Sat Nov 12 20:46:54 2011 +0200
summary:
 Issue 12767: document the argument of threading.Condition.notify
files:
 Doc/library/threading.rst | 19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -656,20 +656,21 @@
 
 .. versionadded:: 3.2
 
- .. method:: notify()
+ .. method:: notify(n=1)
 
- Wake up a thread waiting on this condition, if any. If the calling thread
- has not acquired the lock when this method is called, a
+ By default, wake up one thread waiting on this condition, if any. If the
+ calling thread has not acquired the lock when this method is called, a
 :exc:`RuntimeError` is raised.
 
- This method wakes up one of the threads waiting for the condition
- variable, if any are waiting; it is a no-op if no threads are waiting.
+ This method wakes up at most *n* of the threads waiting for the condition
+ variable; it is a no-op if no threads are waiting.
 
- The current implementation wakes up exactly one thread, if any are
- waiting. However, it's not safe to rely on this behavior. A future,
- optimized implementation may occasionally wake up more than one thread.
+ The current implementation wakes up exactly *n* threads, if at least *n*
+ threads are waiting. However, it's not safe to rely on this behavior.
+ 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
 release the lock, its caller should.
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /