Marko Novakovic
03/18/2022, 7:28 PMUncaught Kotlin exception: kotlin.IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.
Kotlin 1.6.10 and 0.11.3-new-mm https://github.com/rickclephas/KMP-NativeCoroutines (idk if this library has anything to do with it tho)Marko Novakovic
03/18/2022, 7:30 PMclass Count {
@NativeCoroutineScope
private val coroutineScope = MainScope()
private val _count = MutableStateFlow(0)
val count: StateFlow<Int>
get() = _count.asStateFlow()
init {
coroutineScope.launch {
_count.value = 1
delay(500)
_count.value = 2
delay(500)
_count.value = 3
delay(500)
_count.value = 4
delay(500)
_count.value = 5
}
}
}
Rick Clephas
03/18/2022, 8:37 PMMarko Novakovic
03/18/2022, 9:03 PMMarko Novakovic
03/18/2022, 9:06 PMRick Clephas
03/18/2022, 9:15 PMCoroutineScope(SupervisorJob() + Dispatchers.Default)
instead of MainScope()
makes a difference?Marko Novakovic
03/19/2022, 11:41 AMMarko Novakovic
03/19/2022, 11:41 AMMarko Novakovic
03/21/2022, 12:53 PMillegal attempt to access non-shared <object>@2cc6128 from other thread
Marko Novakovic
03/21/2022, 1:09 PMRick Clephas
03/21/2022, 4:26 PMSharedImmutable
or ThreadLocal
.
https://kotlinlang.org/docs/native-immutability.html#global-variables-and-singletonsMarko Novakovic
03/21/2022, 4:32 PMMarko Novakovic
03/21/2022, 4:33 PMkotlin.native.binary.memoryModel=experimental
forgot to add this in gradle.properties