struct
TaskSource
public sealed struct TaskSource Provides a way for us to cancel tasks after common async shit is executed.
Properties
| Name | Type | Description |
|---|---|---|
IsValid | Boolean | |
CompletedTask | Task |
Methods
static TaskSource Create(CancellationToken token = null) static CancellationTokenSource CreateLinkedTokenSource() Create a token source, which will also be cancelled when sessions end
Task Delay(Int32 ms) A task that does nothing for given amount of time in milliseconds.
ms — Time to wait in milliseconds. Task Delay(Int32 ms, CancellationToken ct) A task that does nothing for given amount of time in milliseconds.
ms — Time to wait in milliseconds. ct — Token to cancel the delay early. Task DelaySeconds(Single seconds) A task that does nothing for given amount of time in seconds.
seconds — >Time to wait in seconds. Task DelaySeconds(Single seconds, CancellationToken ct) A task that does nothing for given amount of time in seconds.
seconds — >Time to wait in seconds. ct — Token to cancel the delay early. Task RunInThreadAsync(Action action) Task<T> RunInThreadAsync(Func<T> func) Task RunInThreadAsync(Func<Task> task) Task<T> RunInThreadAsync(Task<T>> task) Task DelayRealtime(Int32 ms) Task DelayRealtime(Int32 ms, CancellationToken ct) Task DelayRealtimeSeconds(Single seconds) Task DelayRealtimeSeconds(Single seconds, CancellationToken ct) SyncTask MainThread() Continues on the main thread.
SyncTask WorkerThread() Continues on a worker thread.
Task<T> FromResult(T t) Task FromCanceled(CancellationToken token) Task FromException(Exception e) Task WhenAll(Task[] tasks) Task WhenAll(IEnumerable<Task> tasks) Task<T[]> WhenAll(Task<T>[] tasks) Task<T[]> WhenAll(Task<T>> tasks) Task WhenAny(Task[] tasks) Task WhenAny(IEnumerable<Task> tasks) Void WaitAny(Task[] tasks) Void WaitAll(Task[] tasks) Task<T>> WhenAny(Task<T>[] tasks) Task<T>> WhenAny(Task<T>> tasks) Task Yield() Task Frame() Wait until the start of the next frame
Task FrameEnd() Wait until the end of the frame
Task FixedUpdate() Wait until the next fixed update