joinAll

suspend fun joinAll(vararg jobs: Job)

Suspends current coroutine until all given jobs are complete. This method is semantically equivalent to joining all given jobs one by one with jobs.forEach { it.join() }.

This suspending function is cancellable. If the Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function immediately resumes with CancellationException. There is a prompt cancellation guarantee. If the job was cancelled while this function was suspended, it will not resume successfully. See suspendCancellableCoroutine documentation for low-level details.


suspend fun Collection<Job>.joinAll()

Suspends current coroutine until all given jobs are complete. This method is semantically equivalent to joining all given jobs one by one with forEach { it.join() }.

This suspending function is cancellable. If the Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function immediately resumes with CancellationException. There is a prompt cancellation guarantee. If the job was cancelled while this function was suspended, it will not resume successfully. See suspendCancellableCoroutine documentation for low-level details.

Sources

Link copied to clipboard
Link copied to clipboard