Suppose I have this structure: ``` suspend fun fun...
# coroutines
j
Suppose I have this structure:
Copy code
suspend fun functionA() {
    // A1
    functionB()
    // A2
}

suspend fun functionB() {
    // B1
    delay(1000)
    // B2
}
where
A1
,
A2
etc denote normal, non-suspending code blocks. I'm trying to understand how these code blocks are scheduled on the available threads. Suppose
functionA
is currently executing on some thread
T1
, using a dispatcher that has multiple threads available. The call to
functionB
is a suspension point - is it correct to say that at that point, executing of my code may be suspended to allow some other work to be done on
T1
? In that case, does that also mean that
B1
can be scheduled on a different thread? I'm pretty sure this happens around the call to
delay
, but I'm uncertain about my own code. Similarly, what about
B2
and
A2
? Are they guaranteed to be executed on the same thread, or is exiting a suspending function also a suspend point?
­čÜź 1
e
Neither call nor return are suspension point. It suspends only when it actually suspends to wait for something.
j
Ah! So A1 and B1 will just execute on the same thread, I get it, thanks!