class threading.Event
Class implementing event objects. An event manages a flag that can be set to true with the set()
method and reset to false with the clear()
method. The wait()
method blocks until the flag is true. The flag is initially false.
Changed in version 3.3: changed from a factory function to a class.
-
is_set()
-
Return true if and only if the internal flag is true.
-
set()
-
Set the internal flag to true. All threads waiting for it to become true are awakened. Threads that call
wait()
once the flag is true will not block at all.
-
clear()
-
Reset the internal flag to false. Subsequently, threads calling
wait()
will block untilset()
is called to set the internal flag to true again.
-
wait(timeout=None)
-
Block until the internal flag is true. If the internal flag is true on entry, return immediately. Otherwise, block until another thread calls
set()
to set the flag to true, or until the optional timeout occurs.When the timeout argument is present and not
None
, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof).This method returns true if and only if the internal flag has been set to true, either before the wait call or after the wait starts, so it will always return
True
except if a timeout is given and the operation times out.Changed in version 3.1: Previously, the method always returned
None
.
Please login to continue.