Coroutines make using nio simpler. For blocking i...
# coroutines
u
Coroutines make using nio simpler. For blocking io they provide little benefit as they will need one thread per io channel anyway
d
@uli So I assumed that a coroutine blocked on (a blocking read or write) will suspend allowing other coroutines on the same thread to be dispatched. Let’s say I had one suspend coroutine doing blocking I/O and a bunch of other coroutines on the same performing some sort of compute, are you saying that the compute coroutines will not be dispatched?
Got it. So just for clarification, if I made a blocking I/O call my whole thread and all associated coroutines on that thread will block on the I/O? That is assuming that my coroutines are not using a context with an underlying thread pool. I think I got this all wrong.
u
Exactly
Same Ist true for long running computations
And instead of a blocking sleep you have delay to suspend for a while
Basically you want no blocking in your coroutines or at least put the blocking on a context with separate threads
d
Thanks Uli.