We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 12d1e9b commit 2848c90Copy full SHA for 2848c90
kotlinx-coroutines-core/jvm/src/scheduling/CoroutineScheduler.kt
@@ -709,11 +709,10 @@ internal class CoroutineScheduler(
709
return
710
}
711
assert { localQueue.size == 0 }
712
- while (inStack()) {
+ workerCtl.value = PARKED // Update value once
713
+ while (inStack()) { // Prevent spurious wakeups
714
if (isTerminated || state == WorkerState.TERMINATED) break
715
tryReleaseCpu(WorkerState.PARKING)
- workerCtl.value = PARKED
716
- if (!inStack()) return
717
interrupted() // Cleanup interruptions
718
park()
719
0 commit comments