[New-bugs-announce] [issue10260] Add a thrading.Condition.wait_for() method

Kristján Valur Jónsson report at bugs.python.org
Sun Oct 31 05:46:49 CET 2010


New submission from Kristján Valur Jónsson <kristjan at ccpgames.com>:

The attached patch adds a wait_for method to condition objects.
It can simplify code that uses condition variables since it relieves the user from writing a condition loop.  In addition it simplifies timeout logic which otherwise has to correctly deal with non-successful wakeups.

We also modify the barrier to use it, giving more robust timeout behaviour.

(btw, the use of time.time() in threading is unfortunate, since it has low resolution and is affected by a user adjusting the clock. On Windows one would want time.clock(), but that function measures CPU time on unix.  Do we need a proper time.wallclock() function available on all platforms?)

----------
components: Library (Lib)
files: wait_for.patch
keywords: patch
messages: 120036
nosy: georg.brandl, krisvale
priority: normal
severity: normal
status: open
title: Add a thrading.Condition.wait_for() method
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file19442/wait_for.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10260>
_______________________________________


More information about the New-bugs-announce mailing list