Managing concurrency
Important Note
Starting with Kotlin 1.6.10, the new memory model is enabled by default, with the official multithreaded coroutines library available for Kotlin/Native. This change makes the following overview and the freezing concept in Kotlin/Native obsolete. While you may bump into the freezing model until the new memory model becomes stable, a pragmatic approach would be revisiting/reading up on freezing-related concepts when the need arises.
In the previous chapters, we saw how Kotlin/Native's concurrency model differs from JVM and that while a new model is being made, it will probably take some time until it's stable. In this section, we'll explore some of the more common concurrency issues that people have and what best practices you can follow to avoid them.
As a quick reminder about Kotlin/Native's concurrency rules, you can only share immutable states between threads. This is done at runtime and is referred to as a frozen state...