[issue17748] Condition.wait timeout can't be set to more than 50 ms

Bill Sobel report at bugs.python.org
Wed Oct 9 23:58:48 CEST 2013


Bill Sobel added the comment:

I'd like to suggest a easy fix here (I saw this was closed, but the posters were asking for a behavior change).  With this fix there is no behavior change to callers or new parameters to the API.


if remaining >= 4.0:
    maxDelay = 1
else:
    maxDelay = .05
delay = min(delay * 2, remaining, maxDelay)

With this fix the loop waits 1 second until it is 'close' to the expiration time then goes into its normal 20 times per-second check.  For long waits this is what is causing the power issue and is alleviated by throttling back on the check when not close to expiration.

----------
nosy: +Bill.Sobel

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


More information about the Python-bugs-list mailing list