Closed belousovgm closed 3 years ago
Hi thanks for the report! What version of kotlinx.coroutines are you using?
1.4.2-native-mt
Ah okay thanks for providing that. CoroutineWorker is meant to be used instead of the native-mt branch. It provides multi-threaded coroutine capabilities in an environment without native-mt. One day when native-mt is merged to main/master coroutines, this library will be no longer needed for example.
For your use case and with native-mt generally, you should use kotlinx.coroutines-provide primitives/methods—don't use CoroutineWorker, as the two are not designed to work together. In this particular case, you probably want to make your own global single-threaded dispatcher to use as an IO dispatcher and use the kotlinx.coroutines withContext method with that dispatcher here.
Going to close, as it's expected that native-mt is not designed to work with CoroutineWorker—in fact it will obsolete it one day. Thanks again for flagging!
When I trying to run this code:
approximately on 10-15th loop iteration iOS app crashes.
Kotlin: 1.4.31 coroutineworker: 0.6.2
Actual implementation of Dispatchers.IO: