Wake waiting tasks once a condition becomes true.
Section: Synchronization Primitives
Signal readiness with an Event
python
python
import asyncio
event = asyncio.Event()
async def waiter():
await event.wait()
print("event received")
async def setter():
await asyncio.sleep(0.2)
event.set()
async def main():
await asyncio.gather(waiter(), setter())
asyncio.run(main())Explanation
Great for one-to-many notifications.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Synchronization Primitives
Protect shared state with a Lock
Prevent overlapping access to a critical section.
Limit concurrency with a Semaphore
Throttle parallel access to a finite resource.
Run an async entrypoint
Execute a top-level coroutine and manage the event loop automatically.