diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-11 17:38:27 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-11 17:38:27 (GMT) |
commit | 1c94ff8b688527faf38c7ed3da6d9a0f7cc45cbe (patch) | |
tree | 860ed8d3858e8b7c96c4186e22852bd2a7b051b2 /Doc | |
parent | b43ef77ecb02daee0bc8bf143cfae5f2fe52b753 (diff) | |
parent | f6cd9b2d46ca5701a20a9cecbe8aba7ae9cc21bd (diff) | |
download | cpython-1c94ff8b688527faf38c7ed3da6d9a0f7cc45cbe.zip cpython-1c94ff8b688527faf38c7ed3da6d9a0f7cc45cbe.tar.gz cpython-1c94ff8b688527faf38c7ed3da6d9a0f7cc45cbe.tar.bz2 |
Improve the threading.Condition docs.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/threading.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 93b5e11..42dbc01 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -584,12 +584,14 @@ producer-consumer situation with unlimited buffer capacity:: # Produce one item with cv: make_an_item_available() + cv.notify() The ``while`` loop checking for the application's condition is necessary because :meth:`~Condition.wait` can return after an arbitrary long time, -and other threads may have exhausted the available items in between. This -is inherent to multi-threaded programming. The :meth:`~Condition.wait_for` -method can be used to automate the condition checking:: +and the condition which prompted the :meth:`~Condition.notify` call may +no longer hold true. This is inherent to multi-threaded programming. The +:meth:`~Condition.wait_for` method can be used to automate the condition +checking, and eases the computation of timeouts:: # Consume an item with cv: |