Join Slack
Powered by
Ehm, I might be stupid -- how can I await on List&...
# coroutines
u
ursus
11/12/2019, 7:12 PM
Ehm, I might be stupid -- how can I await on List<Deferred> ? deferreds.forEach { it.await() } seems to make it sequential
o
octylFractal
11/12/2019, 7:13 PM
what's wrong with doing that sequentially? iirc there is an
List<Deferred<T>>.awaitAll()
, but it does the same thing
u
ursus
11/12/2019, 7:14 PM
well I want parallel execution and wait for all to complete and then proceed. Yes awaitAll is there, facepalm sorry, thanks
w
withoutclass
11/12/2019, 7:15 PM
Unless you specify the async call to be lazy, all the calls will be running in parallel already
withoutclass
11/12/2019, 7:15 PM
so with await all or iterating over the list, you're just waiting for them all to complete
u
ursus
11/12/2019, 7:18 PM
yes im aware, thank you guys
2
Views
Open in Slack
Previous
Next