AH
Size: a a a
AH
AH
AM
RI
AM
AM
АЕ
RI
blocking
. Лучше сделать бесполезный context switch, чем заблокировать io тред сервера, и задача этого модификатора уберечь от таких ошибок.EP
Continuation
из suspendCoroutine
resumed
? Пытался проверить по контексту continuation.context.isActive
но там true, почему-то даже после вызова`resumeWithException`АЕ
EP
@Test
fun testContinuationState() = runBlocking<Unit> {
val scope = CoroutineScope(Dispatchers.Default + Job(coroutineContext[Job]))
val value = suspendCoroutine<Boolean> { continuation ->
scope.launch {
continuation.resume(true)
println("suspendCoroutine resumed")
delay(1000)
println("suspendCoroutineStillActive ${continuation.context.isActive}")
scope.cancel()
}
}
println("suspendCoroutineValue $value")
}
suspendCoroutine resumed
suspendCoroutineValue true
suspendCoroutineStillActive true
EP
BP
RI
@Test
fun testContinuationState() = runBlocking<Unit> {
val scope = CoroutineScope(Dispatchers.Default + Job(coroutineContext[Job]))
val value = suspendCoroutine<Boolean> { continuation ->
scope.launch {
continuation.resume(true)
println("suspendCoroutine resumed")
delay(1000)
println("suspendCoroutineStillActive ${continuation.context.isActive}")
scope.cancel()
}
}
println("suspendCoroutineValue $value")
}
suspendCoroutine resumed
suspendCoroutineValue true
suspendCoroutineStillActive true
BP
EP
EP
EP
RI
BP