Skip to content

Task ​

class in OpalScript

Owned asynchronous work. Compose with All and Race; cancel from the owner.

Properties ​

MemberDescription
Task.IdRead-only task state.
Task.StatusRead-only task state.
Task.ReasonRead-only task state.
Task.IsCompletedRead-only task state.
Task.IsCanceledRead-only task state.
Task.IsFailedRead-only task state.
Task.ResultThe completed result. Only present when the task result type is not void.

Methods ​

MemberDescription
Task.AllWait for all input tasks. Up to 64 heterogeneous tasks, or a snapshot of one task list. Empty input completes. Task.All<T> requires matching Task<T> inputs and returns Task<List<T>> in input order; T cannot be void or List. Composition is owned asynchronous work.
Task.RaceWait for the first terminal input task. Up to 64 tasks with exactly the same result type, or a snapshot of one task list. Empty input is rejected. Task.Race<T> makes the shared result type explicit. Composition is owned asynchronous work.
Task.CancelCancel this owned task and run its synchronous finally cleanup.

See also ​