Joan Colmenero
03/02/2020, 12:42 PMval time = measureTimeMillis {
val one = async { doSomethingUsefulOne() }
val two = async { doSomethingUsefulTwo() }
println("The answer is ${one.await() + two.await()}")
}
println("Completed in $time ms")
because if for instance one.await() crashes what will happen? or if both crashes, is there any way to handle these errors? Or in case I just want to continue with the execution instead of adding the values just printing them, is there any way to print the first one (the one that did not crash) and the others doesn't (if it crashes)?miqbaldc
03/02/2020, 1:02 PMJoan Colmenero
03/02/2020, 1:13 PMstreetsofboston
03/02/2020, 1:19 PMlouiscad
03/02/2020, 1:21 PMcoroutineScope around the two async calls (but nested in the measureTimeMillis lambda.Joan Colmenero
03/02/2020, 1:59 PMlouiscad
03/02/2020, 2:36 PM