Kotlin/Native Concurrency for Mobile Multiplatform
If you're going to build shared Kotlin code with Kotlin/Native, you'll need to understand the concurrency and state model. In this talk, I give you the basics (and a bit more), plus next steps.
kot·lin mul·ti·plat·form /ˌkätˈlin məltiˈplatfôrm,ˌkätˈlin məltīˈplatfôrm/ noun noun: kotlin multiplatform 1.optional, natively-integrated, open-source, code sharing platform, based on the popular, modern language kotlin. facilitates non-ui logic availability on many platforms.
class SimpleState { private var i = 0 val currVal: Int get() = i fun doStuff(arg: Int) { i += arg } } fun main(){ val s = SimpleState() s.doStuff(22) s.doStuff(33) println("My val is ${s.currVal}") }
Freeze • Recursively freezes everything • One-way (no “unfreeze”) • Data may be shared between threads Int String Float MoreData val strData var width SomeData val moreData var count