jw
07/20/2019, 1:08 AMMutex.withLock pattern that supports a suspending body? Aside from just writing it myself, of course. Is there some anti-pattern or gotcha here that prevents it from being provided out-of-the-box?Zach Klippenstein (he/him) [MOD]
07/20/2019, 2:20 AMsuspend fun foo() {
val m = Mutex()
m.withLock {
delay(1000)
}
}jw
07/20/2019, 2:34 AMjw
07/20/2019, 2:34 AMjw
07/20/2019, 2:37 AMjw
07/20/2019, 2:37 AMDico
07/20/2019, 7:40 AMlouiscad
07/20/2019, 9:24 AMalso, apply, etc.), and that's also why there's an inline keyword, not just a compiler optimization.