When there is contention for `Mutex` in kotlin cor...
# coroutines
u
When there is contention for
Mutex
in kotlin coroutines, is the order preserved? i.e. if one arrived during while locked, and there were prior waiting, will it enqueue it after those?
e
https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.sync/-mutex.html
The mutex created is fair: lock is granted in first come, first served order.
u
is it a good idea to use that as a queueing mechanism for “jobs”? or should it be explicit via a flow or something like that
e
Channel is a more natural fit
u
but that needs some sort of event class and then a big when at the receiving end, isnt mutex more elegant?