A suspension point is where a suspending coroutine pauses, freeing its dispatcher thread so other coroutines can run. The coroutine later resumes from its saved state. section 14.6.2
Interleaving coroutines on one thread
In a runBlocking block, one launch calls delay(100.milliseconds). That call suspends the second coroutine, allowing a third coroutine to log and finish before the second resumes. The coroutines interleave without parallel execution.
Suspension points also shape cancellation, flow collection, and coroutine tests:
- Receive CancellationException at suspension points when a coroutine is cancelled; avoid swallowing it with broad exception handlers. section 15.2.4
- Stop a flow collector at the next cancellation point; emit is both a suspension and cancellation point. section 16.2.3
- Let sibling coroutines run in runTest by providing suspension points such as delay or yield; use virtual-time controls for scheduled work. section 18.5.1
