https://kotlinlang.org logo
#coroutines
Title
# coroutines
l

louiscad

04/20/2018, 3:59 PM
The default dispatcher for runBlocking coroutine, in particular, is confined to the invoker thread
Is this still true? Isn't
runBlocking
now using
DefaultDispatcher
, which is equal to
CommonPool
on JVM/Android? Quote from here, second paragraph, third sentence: https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md#unconfined-vs-confined-dispatcher
🤔 1
p

petersommerhoff

04/21/2018, 11:30 AM
@louiscad That's true for other coroutine builders but if you look at
runBlocking
, its default context is actually
EmptyCoroutineContext
so no dispatcher at all AFAICT, so works like Unconfined I guess. That's also why runBlocking keeps running in the main thread and not on something like a ForkJoinPool worker
6 Views