uses that dispatcher when not otherwise specified?
Stephen Edwards
02/04/2021, 7:13 PM
CC @elizarov is there a reason
Dispatchers.Default
coroutines use daemon threads?
n
Niklas Gürtler
02/04/2021, 7:48 PM
The Default dispatcher is special, it uses some worker thread... Not sure what the exact purpose is, probably to do long-running calculations or something like that
z
Zach Klippenstein (he/him) [MOD]
02/04/2021, 7:59 PM
It’s special in that it shares threads with
<http://Dispatchers.IO|Dispatchers.IO>
, not because it uses worker threads. You can create a
CoroutineDispatcher
from any regular java thread pool.
As for the purpose of the default dispatcher, I think that’s pretty well-documented in the official kotlin coroutine docs. This question is specifically about why the default dispatcher’s thread pool threads are daemon threads, instead of just regular threads. Daemon threads are a JVM concept, see the java docs for more.