<@U0YF5LZAB> Please check this section of official...
# coroutines
g
@anthonyandroid Please check this section of official coroutine guide - https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md#concurrent-using-async Also you can check sample from kotlin-coroutines-retrofit (you can use this approach for any coroutine): https://github.com/gildor/kotlin-coroutines-retrofit#parallel-requests
👏 1
a
so your suggestion is to use
await()
for each job I have, to make sure that all the jobs are completed?
just saw the edit, I will take a look. 😉 thx andrey !
g
General idea: build all the coroutines using
async
and when you build and start all of them (they started by default) you just call
await()
on all of them, so when last coroutine finished you will get your results
You can use launch as well, to run some tasks in parallel, but you cannot get results from Job
a
You are right; I was trying to call
start
for every job but now it looks nonsense. They should be started automatically and that sounds faster
g
Yeah, check
start
argument of
async
, you can see that async starts by default https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/async.html
a
very nice. thank u!