Native Concurrency and Coroutines
summary
PlanGrid's Kotlin Multiplatform sync library runs Kotlin/Native coroutines across threads by embedding runBlocking inside a native worker pool (five workers in the demo) and exposing two APIs: execute to run frozen coroutine blocks on background workers and performAndWait which suspends, ships work to a worker, and resumes via an atomicRef holding a Result plus a stableRef to the continuation; uses kotlinx.serialization and SQLDelight, relies on freeze/ensureNeverFrozen/atomic primitives, and works around the missing multi-threaded coroutine support (issue 416).
AI-written summary · about
chapters (9)
- 0:00Introduction to talk
- 2:59Plan Grid app overview
- 7:08Sync system challenges
- 10:38Kotlin Native concurrency rules
- 19:12Implementing coroutine worker
- 24:52Coroutine worker pool
- 28:08Perform and wait explained
- 35:13Library capabilities and summary
- 36:57Q&A and resources
related talks
39mKotlin Native Concurrency Explained
41mCoroutines for Kotlin Multiplatform in practise
42mKotlin Multiplatform multithreading old and new way
42mKotlin Coroutines: Beyond async/await
38mUnderstand Kotlin Coroutines on Android
40mConcurrency made easy with Kotlin Coroutines
32mStructured Concurrency: The paradigm shift
30mBetter asynchronous programming with Kotlin Coroutines
