[issue8799] Hang in lib/test/test_threading.py

Kristján Valur Jónsson report at bugs.python.org
Wed Apr 11 11:19:09 CEST 2012

Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

A few comments:
   with cv:
+       cv.notify()

2) one of the benefits of wait_for() is that it automates the tricky timekeeping needed if one wants an somewhat accurate timeout, you may want to mention this specifically.

3) the offending part.  I see that you don't want to use the technical terms of spurious wakeups or stolen wakeups. That's ok, but the resulting explanation is somwhat bogus.  I suggest the following:

The ``while`` loop checking for the application's condition is necessary
because :meth:`~Condition.wait` can return after an arbitrary long time, and the condition which prompted the :meth:`~Condition.notify` call may not yet, or no longer, hold true.  This is an inherent property of multi-threaded programming and the use of this pattern is essential for the robust use of Condition objects.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list