https://kotlinlang.org logo
Title
e

elizarov

11/14/2017, 4:27 PM
@Fré Dumazy Use
Mutex
f

Fré Dumazy

11/14/2017, 4:35 PM
how should it be used? I'm looking at the api but I don't get it really... 🤔
e

elizarov

11/14/2017, 4:37 PM
val mutex = Mute() 

mutex.withLock { // just like synchronized(lock)
    // critical section
}
f

Fré Dumazy

11/14/2017, 4:39 PM
oh okay, so I shouldn't really use the
lock
,
tryLock
etc methods for a default use case?
e

elizarov

11/14/2017, 4:39 PM
You could, but you should not
withLock
covers the typical use
👍 1
f

Fré Dumazy

11/15/2017, 9:09 AM
It wasn't easy but I finally figured everything out after testing in a new empty project. I also watched your talk "Kotlin Coroutines Reloaded", which helped me understand it. Thanks for that 🙂