When using coroutines it's possible to easily reach a deadlock: thread acquires a lock and suspends, the event loop schedules another coroutine - if that coroutine will start waiting for the same lock a deadlock happens.
A solution is to have an awaitable mutex - one where acquiring a lock is an asynchronous operation as well, so that if the mutex is already locked, the coroutine is suspended and another one runs.
When using coroutines it's possible to easily reach a deadlock: thread acquires a lock and suspends, the event loop schedules another coroutine - if that coroutine will start waiting for the same lock a deadlock happens.
A solution is to have an awaitable mutex - one where acquiring a lock is an asynchronous operation as well, so that if the mutex is already locked, the coroutine is suspended and another one runs.