cancelChildren

fun Job.cancelChildren(
    cause: CancellationException? = null
): Unit
(source)

Cancels all children jobs of this coroutine using Job.cancel for all of them with an optional cancellation cause. Unlike Job.cancel on this job as a whole, the state of this job itself is not affected.