awaitFirst

suspend fun <T> Iterable<Deferred<T>>.awaitFirst(scope: CoroutineScope, cancelOnResult: Boolean = true): T(source)

Trying to Deferred.await on all thiss. The first Deferred completed its work will interrupt all others awaits and, if cancelOnResult passed as true (by default), will also cancel all the others Deferreds

Parameters

scope

Will be used to create CoroutineScope.LinkedSupervisorScope and launch joining of all Jobs in it


suspend fun <T> Iterable<Deferred<T>>.awaitFirst(cancelOthers: Boolean = true): T(source)

Trying to Deferred.await on all thiss. The first Deferred completed its work will interrupt all others awaits and, if cancelOthers passed as true (by default), will also cancel all the others Deferreds

Creates CoroutineScope using coroutineContext for internal purposes


suspend fun <T> awaitFirst(vararg deferreds: Deferred<T>, scope: CoroutineScope, cancelOnResult: Boolean = true): T(source)

Trying to Deferred.await on all deferreds. The first Deferred completed its work will interrupt all others awaits and, if cancelOnResult passed as true (by default), will also cancel all the others deferreds

Parameters

scope

Will be used to create CoroutineScope.LinkedSupervisorScope and launch joining of all Jobs in it


suspend fun <T> awaitFirst(vararg deferreds: Deferred<T>, cancelOthers: Boolean = true): T(source)

Trying to Deferred.await on all deferreds. The first Deferred completed its work will interrupt all others awaits and, if cancelOthers passed as true (by default), will also cancel all the others deferreds

Creates CoroutineScope using coroutineContext for internal purposes