val mutex = Mutex()
suspend fun foo() = mutex.withLock { ... }
g
gildor
12/04/2018, 4:01 PM
What is your use case? Usually better (easier to use, less error-prone) to use actor for that
g
Gta
12/06/2018, 1:51 PM
My usecase was exactly like @andi said but I used Mutex. I will checkout actor then 😉 Thx guys.
k
kevinherron
12/07/2018, 12:51 AM
actor is overkill if mutex will suffice. actor is also deprecated/experimental API. (don't get me wrong, i really like actor, especially what the new typed actor stuff is shaping up to be, but it's overkill for some cases)