diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-11 19:37:56 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-11 19:37:56 +0200 |
commit | 58f6f05508ae15ac5fd89877ed3be6d322f18b52 (patch) | |
tree | e0581698c6a182bc37d13b2d1f49cc4164dfc4ad /Doc | |
parent | d68412785e1453920f55d34c658fb94093688f18 (diff) | |
download | cpython-58f6f05508ae15ac5fd89877ed3be6d322f18b52.tar.gz |
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 8571104c4c..30f7ece6d3 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -561,12 +561,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: |