Книга: Learning Concurrency in Python
Назад: Queues
Дальше: Semaphores and BoundedSemaphores

Events and conditions

, Synchronization between Threads, allow us to block multiple consumers from progressing from a set point until a flag has been set. We can instantiate them as follows:

myEvent = asyncio.Event()

Conditions again allow us to block tasks until a point where they are notified that they can continue by another coroutine. We can instantiate this as follows:

myCondition = asyncio.Condition()
Назад: Queues
Дальше: Semaphores and BoundedSemaphores