[Python-Dev] Any objections to adding threading.Timer?

Aahz Maruch aahz@rahul.net
Fri, 10 Aug 2001 21:42:36 -0700 (PDT)


Guido van Rossum wrote:
>Aahz:
>> 
>> As you note, I'm actually objecting to the whole Condition.wait()
>> feature.  The main problem with this kind of timeout is the way the
>> granularity works; there was a recent post to c.l.py where someone
>> was complaining that it took a full second to respond to the Event()
>> getting set.
> 
> Hm, maybe we should think about adding some low-level thing somewhere
> so that wait(timeout=...) can be implemented more efficiently?  I
> agree that it's ugly now -- busy-waiting with a sleep time doubling
> until it reaches 1 second...

Unfortunately, I don't think this is possible unless we add some
platform-specific code to thread.c, and you'll need to ask Uncle Timmy
for that.  To the extent that I'm an expert on threading, I'm only an
expert on Python threads.

Unless someone is aware of some brilliantly simple solution, I think we
need to live with the ugliness for now, but I'd prefer to discourage
further efforts in the ugly direction.
-- 
                      --- Aahz (@pobox.com)

Hugs and backrubs -- I break Rule 6       <*>       http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista

I don't really mind a person having the last whine, but I do mind someone 
else having the last self-righteous whine.