~/talk

Kotlin Coroutine Mechanisms

Talkat droidcon New York 2024 · 2024-09-19..09-20· [kotlin]
slides:none on file

Playful live examples demonstrate concrete behaviors: runBlocking hijacks the current thread so it blocks main, launch is fire-and-forget (returns a Job) and join suspends until completion, and async returns a Deferred whose await yields the result. Shows a crashing LiveData update on a background thread that is fixed with withContext(Dispatchers.Main). Recommends logging and the KotlinX coroutines debug VM flag. Explains dispatchers: default uses a shared thread pool sized to CPU cores (>=2), IO shares those threads (up to many), and viewModelScope is lifecycle‑aware on Main.

AI-written summary · about

  1. 0:00Introduction
  2. 1:25Playground setup
  3. 3:14runBlocking behavior
  4. 5:00launch coroutine builder
  5. 9:40Modifying task execution
  6. 13:34Execution order with join
  7. 16:11async and deferred results
  8. 21:26Coroutine context and dispatchers
  9. 26:01ViewModelScope vs custom scopes
  10. 30:15Dispatchers IO and Main
  11. 31:42Fixing UI updates
  12. 33:06Resources and closing
~/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.