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

Bjarne Gelotte

04/13/2018, 9:04 AM
Hey! I'm learning about coroutines and have a pretty simple question (I think). I want to do two tasks concurrently:
Copy code
val first:  Deferred<Unit> = async { firstTask() }
val second: Deferred<Unit> = async { secondTask() }

first.await().let { doFirstStuff() }
second.await().let { doSecondStuff() }
In this example, will the
doFirstStuff()
always be called before
doSecondStuff()
? Or can
doSecondStuff
trigger as soon as
second
is evaluated (this is what I want to achieve)?
u

uli

04/14/2018, 11:48 AM
Checkout select
b

Bjarne Gelotte

04/14/2018, 12:38 PM
Interesting, thanks 🙂
3 Views