diff options
author | Eli Bendersky <eliben@gmail.com> | 2011-11-12 18:44:25 (GMT) |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2011-11-12 18:44:25 (GMT) |
commit | d44af82e62998e938dd60ff2bb70ecd6d7d52c05 (patch) | |
tree | abee3d509c3e27719e87cdfbade24e3469a26da4 /Doc | |
parent | 3714c1ebfd12e99e9bf95b9d9867aca3872bce55 (diff) | |
download | cpython-d44af82e62998e938dd60ff2bb70ecd6d7d52c05.zip cpython-d44af82e62998e938dd60ff2bb70ecd6d7d52c05.tar.gz cpython-d44af82e62998e938dd60ff2bb70ecd6d7d52c05.tar.bz2 |
Issue #12767: documenting threading.Condition.notify
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/threading.rst | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 1f1d775..c226dd4 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -634,20 +634,21 @@ the call as often as necessary. .. 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. |