<Coroutines: async() with different dispatchers> I...
# stackoverflow
r
Coroutines: async() with different dispatchers I'm trying to run multiple jobs in parallel via async and wait for the result of all of them. Everything works well in a typical case with a single IO dispatcher: val scope = CoroutineScope(Job()) scope.launch(Dispatchers.IO) { println("starting...") val result = measureTimedValue { loadData() } println("completed. result=${result.value}, time=${result.duration.inWholeSeconds}") } suspend fun loadData(): Int = coroutineScope { val job1 = async { Thread.sleep(1000)...