Atomic Event.{wait,clear}

Aahz Maruch aahz at panix.com
Wed Mar 14 10:00:22 EST 2001


In article <c22l89.2v1.ln at 127.0.0.1>, David Given <dg at pearl.tao.co.uk> wrote:
>
>I'm using the threading module, with the Event class to handle
>synchronisation. It's all working nicely and is very easy to use.
>
>However, I can't seem to find a way of atomically waiting for an Event,
>and then clearing the flag, which is very strange. Currently I do
>Event.wait() and then Event.clear(). If another thread does a Event.set()
>in between the two, the event will be lost. For my current application,
>this isn't a problem, but what shold I do in the future?

I tell people to use Queue.Queue because it handles both synchronization
and data passing.  Is there some reason why that wouldn't work for you?
-- 
                      --- Aahz <*>  (Copyright 2001 by aahz at pobox.com)

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

Python:
    Programming the way
    Guido indented it



More information about the Python-list mailing list