I’m using Kotlin/Native with the new memory model,...
# coroutines
c
I’m using Kotlin/Native with the new memory model, and would like to launch a coroutine that does some blocking I/O. On the JVM, I’d use
<http://Dispatchers.IO|Dispatchers.IO>
for this, but that seems to only exist on the JVM. Is there something else I should use for Kotlin/Native?
j
I think we are supposed to use
Dispatchers.Default
, that’s what I do at least https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html
d
Same question here. The documentation says that
Dispatchers.Default
is for compute-intensive coroutines. How can I get the same elasticity features of
<http://Dispatchers.IO|Dispatchers.IO>
on Kotlin/Native? Is there a dispatcher implementation that allocates new system thread when too many threads are IO-blocked?