We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 980c49d commit e238921Copy full SHA for e238921
sample/src/androidMain/kotlin/com/louiscad/splittiessample/extensions/coroutines/Racing.kt
@@ -19,5 +19,10 @@ suspend inline fun <T> raceOf(vararg racers: suspend CoroutineScope.() -> T): T
19
20
@PublishedApi
21
internal suspend fun <T> List<Deferred<T>>.race(): T = select {
22
- forEach { it.onAwait { result -> forEach(Deferred<T>::cancel); result } }
+ this@race.forEach {
23
+ it.onAwait { result ->
24
+ this@race.forEach { deferred -> deferred.cancel() }
25
+ return@onAwait result
26
+ }
27
28
}
0 commit comments