Point-in-time cancellation probe. Callers that only need to check "has this been cancelled?" at specific points in their code accept a CancelCheck. Compared to CancelToken, this is a strictly read-only capability — no listener registration and therefore no bookkeeping cost for either side.
API authors SHOULD accept the weakest type they actually honour. An entry guard that only does if cancel.isCancelled then ... should take CancelCheck; an operation that aborts a pending Future mid-wait via a registered listener should take CancelToken. Matching the type to the capability makes the API honest: readers know "will this be observed mid-wait?" by looking at the signature.
Every CancelToken is also a CancelCheck — pass a token where a check is expected; Scala handles the promotion automatically.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait CancelToken