eygraber
12/03/2020, 1:04 AMkotlin.coroutines.sync.Mutex
says that:
Memory semantic of the [Mutex] is similar to `synchronized` block on JVM:
Does that mean that if I am in the scope of `Mutex.withLock`I will see the most recent update to mutable fields? e.g.
class MutexText {
private val mutex = Mutex(locked = false)
private var mutable: Any? = null
suspend fun loadOrCreate(): Any {
return mutex.withLock {
mutable ?: Any().let { mutable = it }
}
}
}