~/talk

Coroutine Suspension Mechanics

Talkat droidcon London 2025 · 2025-10-30..10-31· [kotlin, concurrency]
links:none on file
slides:none on file

Explains that the Kotlin compiler rewrites every suspend function into a continuation‑passing signature (adds a continuation parameter) and generates a tiny class per suspend function that holds locals and a label integer; suspension points become n+1 states in a when dispatch, functions return either the real value or a special COROUTINE_SUSPENDED marker, and callbacks turn into suspendCancellableCoroutine + continuation.resumeWith. Notes inline suspend functions merge into the caller FSM, the Job holds a separate lifecycle FSM, and the result is predictable, heap‑small coroutines across JVM/ART.

AI-written summary · about

  1. 0:00Introduction
  2. 1:08Talk overview
  3. 3:37Coroutine suspension magic
  4. 7:17Kotlin state machines
  5. 9:47Direct vs continuation style
  6. 13:24Finite state machines
  7. 21:22Callbacks to coroutines
  8. 23:33State machines in practice
  9. 31:22Nested state machines
  10. 35:36Inline suspend functions
  11. 36:42Job state machine
  12. 37:04Closing
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.