Threading.Event w/ timeout veeeeeery slow on win32?

Aahz Maruch aahz at panix.com
Sat Jul 14 12:31:04 EDT 2001


[cc'd to python-docs]

In article <yoxr8vnaokt.fsf at karhu.tp.spt.fi>,
Ville Vainio  <vvainio at karhu.tp.spt.fi> wrote:
>
>I'm using a Threading.Event object. When I specify a timeout for
>wait(), it takes almost 1 second for the thread that is wait()'ing to
>wake up when I kick the Event obj with a set(). I know I could get
>around this by creating a thread to perform set()'s periodically, but
>since this slowness is not mentioned in the documentation I was
>wondering whether I have misunderstood something.

If you look at Condition() in threading.py, you'll see that the timeout
increases to one second over time.  Note carefully that this has nothing
to do with Windows.  I generally recommend that people code in a way to
avoid using timeouts.  Use Queue.Queue instead.

Perhaps this should be more clearly documented.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

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

"How come we choose from just two people for President but more than 50
for Miss America?"  --AEN



More information about the Python-list mailing list