https://kotlinlang.org logo
Title
w

William Reed

06/14/2021, 8:15 PM
trying to understand what happens when a coroutine is launched in an IO dispatcher (to help in code review). my co-worker has code that launches in an IO dispatcher with code that has no suspend functions (mostly to conform to a previous interface, but lets hand wave that part). since there are no suspend functions, does calling this method always start a new thread? i’m not familiar with the IO dispatcher internals and even though its well documented code there is a lot of it to look through
🇳🇴 1
does it ever start a new thread if these are the only kind of coroutines called? to be more specific they launch multiple coroutines in this fashion so im trying to understand the threading implications
l

louiscad

06/15/2021, 6:39 AM
Look at the KDoc of
<http://Dispatchers.IO|Dispatchers.IO>
, it should answer your questions.
1
m

myanmarking

06/15/2021, 10:45 AM
yes it switches the execution context to IO. It just never suspend