According to the <Dispatchers.IO> doc: &gt; ... us...
# coroutines
s
According to the Dispatchers.IO doc:
... using withContext(Dispatchers.IO) { ... } does not lead to an actual switching to another thread — typically execution continues in the same thread.
So how does it do not to blocking thread but using same thread? When does it really switch another thread? (or never?) --- Edit: The key is
Thread pool
?
👀 1
b
Default and IO dispatchers are using common thread pool. If you will switch from Default to IO it will mark current thread as io (and if there are coroutines waiting for Default dispatcher, it will spawn one more thread)
3