diff options
author | Petri Lehtinen <petri@digip.org> | 2011-11-12 19:23:28 (GMT) |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2011-11-12 19:23:28 (GMT) |
commit | f89d8fcc36555b324a0fd9aa3a81c810570fdd80 (patch) | |
tree | 85110dde2a4977b1b3279942988a779b31d279c5 | |
parent | 516d80530ba1871e192f1ac50bf8b5e7be77c827 (diff) | |
parent | bf9d34ce7e8b25bdbd41b34a042dd8695e2dbb7a (diff) | |
download | cpython-f89d8fcc36555b324a0fd9aa3a81c810570fdd80.zip cpython-f89d8fcc36555b324a0fd9aa3a81c810570fdd80.tar.gz cpython-f89d8fcc36555b324a0fd9aa3a81c810570fdd80.tar.bz2 |
Merge heads
-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 66b3501..aaec588 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -656,20 +656,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. |