IRomanov
08/30/2018, 9:49 PMasync
coroutine builder to execute some blocking code in parallel. I use my custom thread pool for that. But is it ok to call regular (non-suspending) function inside async
?
fun doSomething(s: String): String {
// blocking code
}
val def1 = async(myContext) { doSomething("a") }
val def2 = async(myContext) { doSomething("b") }
// ...
println("${def1.await()} ${def2.await()}")
rocketraman
08/30/2018, 9:51 PMIO
dispatcher for the non-suspending blocking code.rocketraman
08/30/2018, 9:59 PMIRomanov
08/30/2018, 10:14 PMuli
08/31/2018, 7:02 AMrocketraman
08/31/2018, 8:23 AMIO
pool.uli
08/31/2018, 8:52 AM