elizarov03/02/2017, 5:24 PM
with coroutines. It blocks a thread when the lock is busy, but threads are expensive resource. Assuming that you are already using coroutines (to do everything in the single thread or in a few threads), you should not want to block a thread. You can always use
that gives you basically the same capabilities, but the thread is not blocked (coroutine is suspended instead).