Skip to content

L14: Suspension and Concurrency Scopes

In this lesson we will explore:

  • Deep Theory: suspend functions, Job lifecycle, coroutine builders (launch, async/await), coroutineScope, and cooperative cancellation checking isActive / yield.
  • Under the Hood: Compiler transformation to State Machines (Continuation Passing Style - CPS) and the hidden Continuation<T> parameter.
  • Incremental Lab (AI Chat CLI): Building a concurrent “AI is typing…” console animation that renders smoothly alongside incoming response streams.