Skip to content

Glossary: Swift Beyond the Basics

cancellation

Also written: cancel, Task.isCancelled, CancellationError, checkCancellation

Asking a task to stop. It is cooperative: `cancel()` only sets a flag, and the task must check it (for example with `Task.isCancelled`) or sleep, which throws `CancellationError`.

Where the book teaches it

Related terms

unstructured tasktask groupstructured concurrency