TCancellation

A cancellation request for asynchronous or blocking synchronous operations.

It is passed to the entity creating an operation, which will usually monitor it either by polling or by adding event handlers, and cancel the operation if it is triggered.

For synchronous operations, this usually means either throwing a TCancelledException or immediately returning, depending on whether cancellation is an expected part of the task outcome or not. For asynchronous operations, cancellation typically entails stopping background work and cancelling a result future, if not already completed.

An operation accepting a TCancellation does not need to guarantee that it will actually be able to react to the cancellation request.

Members

Functions

throwIfTriggered
void throwIfTriggered()

Throws a TCancelledException if the cancellation request has already been triggered.

triggered
bool triggered()

Whether the cancellation request has been triggered.

triggering
TAwaitable triggering()

A TAwaitable that can be used to wait for cancellation triggering.

Meta