New submission from Kristján Valur Jónsson <krist...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue10260>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to