Class AsyncUtils
A set of utilities around and for better asynchronous behavior.
Assembly: Dalamud.dll
Declaration
public static class AsyncUtils
Methods
FirstSuccessfulTask<T>(ICollection<Task<T>>)
Race a set of tasks, returning either the first to succeed or an aggregate of all exceptions. This helper does not perform any automatic cancellation of losing tasks, nor does it handle exceptions of losing tasks.
Declaration
public static Task<T> FirstSuccessfulTask<T>(ICollection<Task<T>> tasks)
Returns
System.Threading.Tasks.Task<<T>>: Returns the first task that completes, according to System.Threading.Tasks.Task.IsCompletedSuccessfully.
Parameters
| Type | Name | Description |
|---|---|---|
System.Collections.Generic.ICollection<System.Threading.Tasks.Task<<T>>> | tasks | A list of tasks to race. |
Type Parameters
| Name | Description |
|---|---|
T | The return type of all raced tasks. |
Exceptions
System.AggregateException
Thrown when all tasks given to this method fail.
CancellableDelay(int, CancellationToken)
Provide a System.Threading.Tasks.Task.Delay(System.Int32%2cSystem.Threading.CancellationToken) that won't throw an exception when it's canceled.
Declaration
public static Task CancellableDelay(int millisecondsDelay, CancellationToken cancellationToken)
Returns
System.Threading.Tasks.Task
Parameters
| Type | Name |
|---|---|
System.Int32 | millisecondsDelay |
System.Threading.CancellationToken | cancellationToken |