Table of Contents

ICancellationToken Interface

Tells the code doing some work that it should stop.

Remarks

Obtained from ICancellationTokenSource.Token, or from TCancellationToken.None when an API asks for a token and there is nothing to cancel. Cancellation is one-way and permanent: once requested, a token stays canceled. All members are thread safe.

Syntax

Unit: Bcl.Cancellation

ICancellationToken = interface(IInterface);

Methods

Name Description
CanBeCanceled Whether this token can ever be canceled. False only for TCancellation​Token.​None.
IsCancellation​Requested Whether cancellation has been requested.
Register Registers a procedure to be called when cancellation is requested.
ThrowIfCancellation​Requested Raises EOperationCancelled if cancellation has been requested; does nothing otherwise.
WaitFor Waits up to ATimeoutMs milliseconds for cancellation.