elizarov
09/13/2017, 7:48 PMCommonPool
since you don’t know how many threads are there and whether your blocking op will leave any of them. CommonPool
is better suited for CPU-intensive tasks. So if you have some long-running computation that you don’t want to cary in your UI thread, but need its result in UI, you’ll do:
fun compute() = run(CommonPool) { ... computation ... }
// somewhere in UI
launch(UI) { displayResults(compute()) }