cancel

fun CoroutineScope.cancel(
    cause: CancellationException? = null
): Unit
(source)

Cancels this scope, including its job and all its children with an optional cancellation cause. A cause can be used to specify an error message or to provide other details on a cancellation reason for debugging purposes. Throws IllegalStateException if the scope does not have a job in it.

fun CoroutineScope.cancel(
    message: String,
    cause: Throwable? = null
): Unit
(source)

Cancels this scope, including its job and all its children with a specified diagnostic error message. A cause can be specified to provide additional details on a cancellation reason for debugging purposes. Throws IllegalStateException if the scope does not have a job in it.

fun Job.cancel(
    message: String,
    cause: Throwable? = null
): Unit
(source)

Cancels current job, including all its children with a specified diagnostic error message. A cause can be specified to provide additional details on a cancellation reason for debugging purposes.