Modern versions of asyncio.locks.

asyncio primitives call get_event_loop() in __init__, which makes them unsuitable for use in programs that don’t want to pass the loop around.

class mode.utils.locks.Event(*, loop: = None)

Asynchronous equivalent to 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.

is_set() → bool

Return True if and only if the internal flag is true.

set() → None

Set the internal flag to true.

All coroutines waiting for it to become true are awakened. Coroutine that call wait() once the flag is true will not block at all.

clear() → None

Reset the internal flag to false.

Subsequently, coroutines calling wait() will block until set() is called to set the internal flag to true again.

async wait() → bool

Block until the internal flag is true.

If the internal flag is true on entry, return True immediately. Otherwise, block until another coroutine calls set() to set the flag to true, then return True.

property loop