~/talk

Kotlin Coroutines

Talkat Mobile Era 2017 · 2017-10-05..10-06· [kotlin]
slides:none on file

Kotlin 1.1 implements async/await as library functions backed by coroutines so asynchronous work looks sequential; async returns a Deferred (promise/future) with await which suspends the coroutine without blocking threads. Coroutines are lightweight, compile with a hidden compiler adds Continuation parameter and become a state machine so only one object represents suspension points; builders include async, launch and runBlocking, cancellation is cooperative, exceptions propagate via try/catch, contexts let you resume on UI or thread pools, and the library (channels, actors) is currently experimental.

AI-written summary · about

  1. 0:00Intro
  2. 0:26Kotlin Coroutines
  3. 3:10Solution 1: callbacks
  4. 5:52Coroutine is similar to a thread
  5. 10:58Example: waiting for two asynchronous computations to complete
  6. 12:09Stepping back: what's wrong with blocking thread?
  7. 15:37async starts new computation
  8. 16:24await is a suspend function
  9. 16:56await suspends computation
  10. 21:58Custom executor async (CustomContext)
  11. 24:56Computation on Ul thread
  12. 26:37Check cancellation explicitly in computation code
  13. 27:03Library suspend functions like await, delay check for cancellation
  14. 27:15You can run the code without cancellation
  15. 27:29Programming with suspend functions
  16. 29:00Example: simple consecutive logic
  17. 31:29Rewrite with suspend functions
  18. 33:50Coroutine Builders start a coroutine
  19. 35:30Nested coroutines
  20. 37:05Implementation details
  21. 46:22Experimental status of Coroutines
~/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.