isActive

Returns true when current Job is still active (has not completed and was not cancelled yet).

Check this property in long-running computation loops to support cancellation:

while (isActive) {
    // do some computation
}

This property is a shortcut for coroutineContext.isActive in the scope when CoroutineScope is available. See coroutineContext, isActive and Job.isActive.