pakoito
10/25/2017, 4:47 PMdave08
10/26/2017, 2:31 AMlaunch {
val async1 = async(CommomPool) { ... }
val async2 = async(CommonPool) { ... }
// Some long running code
doSomthing(async1.await(), async2.await())
}
This should start the asyncs when they get declared, and wait for their values before doSomething is called. But they will both run async each one from a different thread of CommonPool. They will only block when doSomething needs their results.