ank
01/04/2023, 5:23 AMsuspend fun x() {
print("A")
y()
print("C")
}
suspend fun y() {
print("B")
}
ephemient
01/04/2023, 5:27 AMsuspend fun
escapes structured concurrency (either by explicitly giving it a CoroutineScope
to allow it to do so, or if it breaks conventions by launching into an unrelated scope) then all `suspend fun`s run to completion in sequenceephemient
01/04/2023, 5:31 AMephemient
01/04/2023, 5:32 AMsuspend fun x() {
coroutineScope {
print("A")
y(this@coroutineScope)
print("B")
}
}
fun y(scope: CoroutineScope) {
scope.launch {
print("C")
}
}
ank
01/04/2023, 5:33 AMank
01/04/2023, 5:33 AMPablichjenkov
01/04/2023, 12:07 PMephemient
01/05/2023, 3:47 AMank
01/05/2023, 3:47 AMank
01/05/2023, 3:48 AMank
01/05/2023, 3:49 AMPablichjenkov
01/05/2023, 4:16 AM