children

abstract val children: Sequence<Job>(source)

Returns a sequence of this job's children.

A job becomes a child of this job when it is constructed with this job in its CoroutineContext or using an explicit parent parameter.

A parent-child relation has the following effect:

  • Cancellation of parent with cancel or its exceptional completion (failure) immediately cancels all its children.

  • Parent cannot complete until all its children are complete. Parent waits for all its children to complete in completing or cancelling state.

  • Uncaught exception in a child, by default, cancels parent. This applies even to children created with async and other future-like coroutine builders, even though their exceptions are caught and are encapsulated in their result. This default behavior can be overridden with SupervisorJob.