https://kotlinlang.org logo
#coroutines
Title
# coroutines
p

pakoito

10/25/2017, 4:47 PM
executing one after another, like with andThen
d

dave08

10/26/2017, 2:31 AM
I think Daniil is right try
Copy code
launch {
     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.
6 Views