Skip to content

Suspension point

Category: Scheduling · Status: stub · Lessons: chapter 06, Async (planned)

One line: A place where a coroutine or async function can pause and hand control back — an await, a yield — and where other tasks may run before it resumes.

Also called: await point, yield point.

How it connects

flowchart LR
  n_async_await["Async and await"]
  n_cooperative_scheduling["Cooperative scheduling"]
  n_suspension_point["Suspension point"]
  n_async_await -->|uses| n_suspension_point
  n_cooperative_scheduling -->|uses| n_suspension_point
  classDef center stroke-width:3px
  class n_suspension_point center
  classDef outside stroke-dasharray: 4 3
  class n_async_await,n_cooperative_scheduling outside

In each language

Rust Each .await
Go No marked points: goroutines have been asynchronously preemptible ↗ since Go 1.14
C++ co_await and co_yield
Python await, and the implicit awaits in async for and async with
C# await
JavaScript await, and yield in a generator
Kotlin A call to a suspending function ↗, which pauses and resumes without blocking a thread
Swift await marks each possible suspension point

Where to read more