@@ -11,11 +11,10 @@ import kotlin.coroutines.*
11
11
* This function is **not** equivalent to `deferreds.map { it.await() }` which fails only when it sequentially
12
12
* gets to wait for the failing deferred, while this `awaitAll` fails immediately as soon as any of the deferreds fail.
13
13
*
14
- * This suspending function is cancellable.
15
- * If the [Job] of the current coroutine is cancelled or completed while this suspending function is waiting,
16
- * this function immediately resumes with [CancellationException].
17
- * There is a **prompt cancellation guarantee**. If the job was cancelled while this function was
18
- * suspended, it will not resume successfully. See [suspendCancellableCoroutine] documentation for low-level details.
14
+ * This suspending function is cancellable: if the [Job] of the current coroutine is cancelled or completed while this
15
+ * suspending function is waiting, this function immediately resumes with [CancellationException].
16
+ * There is a **prompt cancellation guarantee**: even if this function is ready to return the result, but was cancelled
17
+ * while suspended, [CancellationException] will be thrown. See [suspendCancellableCoroutine] for low-level details.
19
18
*/
20
19
public suspend fun <T > awaitAll (vararg deferreds : Deferred <T >): List <T > =
21
20
if (deferreds.isEmpty()) emptyList() else AwaitAll (deferreds).await()
@@ -28,11 +27,10 @@ public suspend fun <T> awaitAll(vararg deferreds: Deferred<T>): List<T> =
28
27
* This function is **not** equivalent to `this.map { it.await() }` which fails only when it sequentially
29
28
* gets to wait for the failing deferred, while this `awaitAll` fails immediately as soon as any of the deferreds fail.
30
29
*
31
- * This suspending function is cancellable.
32
- * If the [Job] of the current coroutine is cancelled or completed while this suspending function is waiting,
33
- * this function immediately resumes with [CancellationException].
34
- * There is a **prompt cancellation guarantee**. If the job was cancelled while this function was
35
- * suspended, it will not resume successfully. See [suspendCancellableCoroutine] documentation for low-level details.
30
+ * This suspending function is cancellable: if the [Job] of the current coroutine is cancelled or completed while this
31
+ * suspending function is waiting, this function immediately resumes with [CancellationException].
32
+ * There is a **prompt cancellation guarantee**: even if this function is ready to return the result, but was cancelled
33
+ * while suspended, [CancellationException] will be thrown. See [suspendCancellableCoroutine] for low-level details.
36
34
*/
37
35
public suspend fun <T > Collection<Deferred<T>>.awaitAll (): List <T > =
38
36
if (isEmpty()) emptyList() else AwaitAll (toTypedArray()).await()
@@ -41,23 +39,21 @@ public suspend fun <T> Collection<Deferred<T>>.awaitAll(): List<T> =
41
39
* Suspends current coroutine until all given jobs are complete.
42
40
* This method is semantically equivalent to joining all given jobs one by one with `jobs.forEach { it.join() }`.
43
41
*
44
- * This suspending function is cancellable.
45
- * If the [Job] of the current coroutine is cancelled or completed while this suspending function is waiting,
46
- * this function immediately resumes with [CancellationException].
47
- * There is a **prompt cancellation guarantee**. If the job was cancelled while this function was
48
- * suspended, it will not resume successfully. See [suspendCancellableCoroutine] documentation for low-level details.
42
+ * This suspending function is cancellable: if the [Job] of the current coroutine is cancelled or completed while this
43
+ * suspending function is waiting, this function immediately resumes with [CancellationException].
44
+ * There is a **prompt cancellation guarantee**: even if this function is ready to return the result, but was cancelled
45
+ * while suspended, [CancellationException] will be thrown. See [suspendCancellableCoroutine] for low-level details.
49
46
*/
50
47
public suspend fun joinAll (vararg jobs : Job ): Unit = jobs.forEach { it.join() }
51
48
52
49
/* *
53
50
* Suspends current coroutine until all given jobs are complete.
54
51
* This method is semantically equivalent to joining all given jobs one by one with `forEach { it.join() }`.
55
52
*
56
- * This suspending function is cancellable.
57
- * If the [Job] of the current coroutine is cancelled or completed while this suspending function is waiting,
58
- * this function immediately resumes with [CancellationException].
59
- * There is a **prompt cancellation guarantee**. If the job was cancelled while this function was
60
- * suspended, it will not resume successfully. See [suspendCancellableCoroutine] documentation for low-level details.
53
+ * This suspending function is cancellable: if the [Job] of the current coroutine is cancelled or completed while this
54
+ * suspending function is waiting, this function immediately resumes with [CancellationException].
55
+ * There is a **prompt cancellation guarantee**: even if this function is ready to return the result, but was cancelled
56
+ * while suspended, [CancellationException] will be thrown. See [suspendCancellableCoroutine] for low-level details.
61
57
*/
62
58
public suspend fun Collection<Job>.joinAll (): Unit = forEach { it.join() }
63
59
0 commit comments