cancel

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

Cancels this job with an optional cancellation cause. A cause can be used to specify an error message or to provide other details on the cancellation reason for debugging purposes. See Job documentation for full explanation of cancellation machinery.