3 ms·
Is this what you are supposed to use asyncio classes for?
by brian_herman__ 8y ago
Is this what you are supposed to use asyncio classes for?
- takeda 8y agoasyncio is a low level cooperative multitasking framework. Locking by all means is an appropriate use of asyncio, if lock can be acquired the program simply executes with interruption, if the lock was previously acquired instead blocking the thread, asyncio makes the thread execute another coroutine.
- greglindahl 8y agoThere are reasonable circumstances when you'd want these. For example, I might have a daemon where a call modifies some state, makes an async outcall, then modifies more state, and then returns an answer. This function might not be re-entrant. If so, you'll want a lock. This is a fairly common issue in concurrent programming.