public class NonCancellable implements Job
A non-cancelable job that is always active. It is designed for BuildersKt.withContext function
to prevent cancellation of code blocks that need to be executed without cancellation.
Use it like this:
withContext(NonCancellable) {
// this code will not be cancelled
}
BuildersKt.withContextJob.DefaultImpls, Job.Key| Modifier and Type | Field and Description |
|---|---|
static NonCancellable |
INSTANCE
A non-cancelable job that is always active. It is designed for
BuildersKt.withContext function
to prevent cancellation of code blocks that need to be executed without cancellation. |
cancel, cancel, getChildren, getOnJoin, invokeOnCompletion, isActive, isCancelled, isCompleted, join, startpublic static NonCancellable INSTANCE
A non-cancelable job that is always active. It is designed for BuildersKt.withContext function
to prevent cancellation of code blocks that need to be executed without cancellation.
Use it like this:
withContext(NonCancellable) {
// this code will not be cancelled
}
BuildersKt.withContext