https://kotlinlang.org logo
Title
a

Adriano Celentano

09/09/2019, 2:15 PM
Each suspend function has exactly one Continuation object, right or wrong ?
s

streetsofboston

09/09/2019, 2:19 PM
It has a (hidden)
Continuation
parameter.
d

Dominaezzz

09/09/2019, 2:24 PM
Multiple
Continuation
objects could also be created within the suspend function.
a

Adriano Celentano

09/09/2019, 3:28 PM
@Dominaezzz when would that happen ? @streetsofboston yeah i mean the compiler adds one Conitnuation object per suspend function (originaly i thought it is one Continuation object per coroutine)
d

Dominaezzz

09/09/2019, 3:42 PM
When a suspend function is called within it.
s

streetsofboston

09/09/2019, 3:48 PM
Each suspension point is associated with one Continuation. Basically, the Continuation carries the result (good result or exception) and a ‘pointer/label’ that determines where the suspension point must resume.
1
a

Adriano Celentano

09/09/2019, 8:07 PM
@streetsofboston thx for confirming. @Dominaezzz i think when a supsend function is called within it, it gets the coninuation object from the calling function passed and the called function again has its own continuation object it can potentially pass on to other suspedn functions