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

API Browser

Method

Cancel

func Cancel() -> bool

Declaring type: Promise<T>
Module: System.Concurrency.Tasks
Assembly: System.Runtime.dll
Source file: Tasks.rvn

Cancels a pending task and posts its registered callbacks.

Return value

Boolean

True if this call cancelled the task; false if it was already completed or cancelled.

Remarks

This changes the promise state. It does not stop a worker or cancel the host invocation. Awaiting a cancelled input propagates cancellation to the enclosing async task.