Animesh Sahu
11/15/2019, 5:10 AMfun main() = runBlocking<Unit> {
launch(Dispatchers.Default) {
println("Default : I'm working in thread ${Thread.currentThread().name}")
}
launch(<http://Dispatchers.IO|Dispatchers.IO>) {
println("IO : I'm working in thread ${Thread.currentThread().name}")
}
}
Output:
Default : I'm working in thread DefaultDispatcher-worker-1
IO : I'm working in thread DefaultDispatcher-worker-3
bdawg.io
11/15/2019, 5:13 AMIt is backed by a shared pool of threads on JVM. By default, the maximum number of threads used by this dispatcher is equal to the number of CPU cores, but is at least two.IO:
Additional threads in this pool are created and are shutdown on demand. ... It defaults to the limit of 64 threads or the number of cores (whichever is larger).
Animesh Sahu
11/15/2019, 5:18 AMbdawg.io
11/15/2019, 5:21 AMAnimesh Sahu
11/15/2019, 5:25 AMEvgeniy Zaharov
11/15/2019, 8:13 AMAnimesh Sahu
11/15/2019, 8:38 AMEvgeniy Zaharov
11/15/2019, 8:44 AM