class Job
source · line 14public open class Job internal constructor(
parent: Job?,
private val propagatesFailure: Boolean = true
)
Tracks a coroutine and its structured children. Completion waits for children; cancellation requests propagate to children and registered handlers.
function cancel
source · line 54public fun cancel(): Unit
Requests cancellation of this job and its children. Repeated requests preserve the existing cancellation outcome.
function ensureActive
source · line 45public fun ensureActive(): Unit
Throws the job's cancellation exception when cancellation has been requested.
property isCancelled
source · line 39public val isCancelled: Boolean
get: public read-only
Whether cancellation has been requested for this job.
getter get
source · line 39get(): Boolean
function invokeOnCancellation
source · line 62public fun invokeOnCancellation(handler: (CancellationException) -> Unit): Disposable
Registers a cancellation handler and returns a disposable registration; an already-cancelled job invokes it immediately.
parameter handler
source · line 62handler: (CancellationException) -> Unit
property isCompleted
source · line 34public val isCompleted: Boolean
get: public read-only
Whether the job and its children have reached a terminal state.
getter get
source · line 34get(): Boolean
function join
source · line 301public suspend fun join(): Unit
Suspends until this job completes, including its children. Joining does not retrieve a deferred result.