[Python-checkins] cpython (3.2): Improve the threading.Condition docs.

antoine.pitrou python-checkins at python.org
Wed Apr 11 19:44:10 CEST 2012


http://hg.python.org/cpython/rev/9d4109af8f3b
changeset:   76245:9d4109af8f3b
branch:      3.2
parent:      76242:2776ccf003cc
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Apr 11 19:37:56 2012 +0200
summary:
  Improve the threading.Condition docs.

files:
  Doc/library/threading.rst |  8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -561,12 +561,14 @@
    # 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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list