A coroutine is stuck in a tight CPU loop with no suspension points. The surrounding scope is cancelled. Why does the coroutine keep running, and what is the minimal cooperative fix?
val job = scope.launch(Dispatchers.Default) {
var x = 0L
while (true) {
x += compute(x) // pure CPU, never suspends
}
}
delay(50)
job.cancelAndJoin()