Terry Hope
12/06/2023, 10:06 PMsuspend fun apple() {
"some work"
banana() // suspension point?
delay(2) // suspension point
"some work"
yield() // suspension point
}
suspend fun banana() {
"doing some work"
}
A suspension point — is a point during coroutine execution where the execution of the coroutine may be suspended. Syntactically, a suspension point is an invocation of suspending function, but the actual suspension happens when the suspending function invokes the standard library primitive to suspend the execution.
Help me understand this please.
In the above code sample does the call to banana() is potentially suspension point even thought banana itself does not have any suspend points inside?bezrukov
12/06/2023, 10:17 PMTerry Hope
12/06/2023, 10:31 PMkevin.cianfarini
12/06/2023, 11:02 PMThis function throws a CancellationException if the Job of the coroutine is cancelled or completed while it is suspended.
kevin.cianfarini
12/06/2023, 11:03 PM