Exerosis
12/18/2021, 4:22 PMvar resumePoint: Continuation<String>? = null
var hasJumpedBack = false
suspend fun test() = suspendCoroutineUninterceptedOrReturn<String> {
resumePoint = it
"Hello "
}
fun jumpBack() {
if (!hasJumpedBack) {
hasJumpedBack = true
resumePoint?.resume("World")
}
}
runBlocking {
println("Starting")
val result = test()
println(result)
jumpBack()
}
It had to be testedJoffrey
12/18/2021, 5:46 PMCompletableDeferred
for this kind of use caseExerosis
12/18/2021, 5:49 PMJoffrey
12/18/2021, 7:43 PMresumePoint
could be a CompletableDeferred
that you await
in test()
and complete successfully in jumpBack()
Exerosis
12/18/2021, 9:20 PMJoffrey
12/18/2021, 9:31 PMsuspendCoroutineUninterceptedOrReturn
😆Exerosis
12/18/2021, 9:44 PM