Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Class

CancellationTokenSource

class CancellationTokenSource

Module: System.Concurrency
Assembly: System.Runtime.dll
Source file: Cancellation.rvn

Inheritance: Object → CancellationTokenSource
Implements: Disposable

Owns cancellation authority. Requesting cancellation does not complete an operation.

Constructors

1 item
CancellationTokenSource() Creates an active source with no cancellation request.

Properties

2 items
IsCancellationRequested: bool Whether Cancel has been called; this remains readable after disposal.
Token: CancellationToken A token sharing this source's request state.

Methods

8 items
Cancel() -> () Sets the request flag and invokes active callbacks synchronously in reverse registration order.
CancelAfter(delay: Duration) -> () Requests cancellation after delay; another call replaces the pending countdown. Zero is deferred. Negative or excessive durations fault, even after cancellation.
CancelAfter(delay: Optional<Duration>) -> () Some schedules cancellation; None disables the pending countdown without cancelling.
Dispose() -> () Releases registrations without requesting cancellation. Repeated disposal is harmless. Implements Disposable.Dispose
Equals(other: object?) -> bool Tests reference identity by default; an ordinary class may override equality. Inherited from Object.Equals
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
ToString() -> string Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override. Inherited from Object.ToString