Hi all, when a coroutine get transferred to a diff...
# coroutines
h
Hi all, when a coroutine get transferred to a different context by
WithContext
to do a blocking operation like connecting and writing a db statement, if the threads of the dispatcher, say
<http://Dispatcher.IO|Dispatcher.IO>
, are already used up and no thread is available immediately, do the coroutine just wait until a thread is available and essentially block the thread it’s running on? Thanks in advance
r
withContext
is a suspend function, so it does not block the calling thread; the thread can be used by other coroutines while this one is waiting. But yes, it is possible that this coroutine may be idle as it waits for the dispatcher to have a thread available for use
h
Thanks for the info, @rkechols