June 2017
Beginner to intermediate
274 pages
6h 49m
English
The asyncio package provides lock, semaphore, event, and condition classes that are pretty similar to the ones we looked at in the context of concurrent.futures. They provide the same method names and fulfill the same roles. The important difference is that for asyncio's versions, some of the methods are coroutines and some are not, as shown here:

Specifically, in each case, the acquire and wait methods, if they exist, are coroutines that must be called by await.
This is because they need to be able to pause until some specific thing happens, and only a coroutine can pause and hand over control to the scheduler. ...
Read now
Unlock full access