<@U7CAXT0BB> Use `Mutex`
# coroutines
e
@Fré Dumazy Use
Mutex
f
how should it be used? I'm looking at the api but I don't get it really... 🤔
e
Copy code
val mutex = Mute() 

mutex.withLock { // just like synchronized(lock)
    // critical section
}
f
oh okay, so I shouldn't really use the
lock
,
tryLock
etc methods for a default use case?
e
You could, but you should not
withLock
covers the typical use
👍 1
f
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 🙂