mp
04/01/2022, 9:38 AMkotlin.concurrent
@kotlin.internal.InlineOnly
public inline fun <T> Lock.withLock(action: () -> T): T {
contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) }
lock()
try {
return action()
} finally {
unlock()
}
}
but it says The 'checkRegistry' suspension point is inside a critical section
Newbee with corutines\suspend so - can anyone share document reference that will help me to understand what I’ve missSam
04/01/2022, 9:41 AMLock
is designed for use with blocking code running in threads. If you absolutely need to use locks with coroutines you should use Mutex instead.mp
04/01/2022, 9:44 AM