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

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


http://hg.python.org/cpython/rev/d3c2d8358f54
changeset:   76246:d3c2d8358f54
parent:      76244:f5f8a7fd881c
parent:      76245:9d4109af8f3b
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Apr 11 19:38:27 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
@@ -584,12 +584,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