Anvil
|
Asynchronous tasks and helpers for running NWN APIs in an async context. More...
Static Public Member Functions | |
static Task | Delay (TimeSpan delay, CancellationToken? cancellationToken=null) |
Waits until the specified amount of time has passed. More... | |
static Task | DelayFrame (int frames, CancellationToken? cancellationToken=null) |
Waits until the specified amount of frames have passed. More... | |
static Task | NextFrame () |
Waits until the next server frame/loop. More... | |
static async Task | Run (Func< Task > function) |
Queues the specified work to run on the next server cycle. More... | |
static async Task< T > | Run< T > (Func< Task< T >> function) |
static IAwaitable | SwitchToMainThread () |
Safely returns to a NWScript context from another thread. This must ALWAYS be called after an external callback, or thread switch before using any NWN APIs. More... | |
static Task | WaitUntil (Func< bool > test, CancellationToken? cancellationToken=null) |
Waits until the specified expression returns true. More... | |
static Task | WaitUntilValueChanged< T > (Func< T > valueSource, CancellationToken? cancellationToken=null) |
Waits until the specified value source changes. More... | |
static async Task | WhenAll (IEnumerable< Task > tasks) |
static async Task | WhenAll (params Task[] tasks) |
Waits until all the specified tasks have completed. More... | |
static async Task< TResult[]> | WhenAll< TResult > (IEnumerable< Task< TResult >> tasks) |
static async Task< TResult[]> | WhenAll< TResult > (params Task< TResult >[] tasks) |
static async Task | WhenAny (IEnumerable< Task > tasks) |
static async Task | WhenAny (params Task[] tasks) |
Waits until any of the specified tasks have completed. NOTE: This will not cancel other tasks that have not finished running. Specify a common CancellationToken in each of the source tasks. More... | |
static async Task< Task< TResult > > | WhenAny< TResult > (IEnumerable< Task< TResult >> tasks) |
static async Task< Task< TResult > > | WhenAny< TResult > (params Task< TResult >[] tasks) |
Asynchronous tasks and helpers for running NWN APIs in an async context.
|
inlinestatic |
Waits until the specified amount of time has passed.
delay | How long to wait. |
cancellationToken | A cancellation token that should be used to cancel the work. |
|
inlinestatic |
Waits until the specified amount of frames have passed.
frames | The number of frames to wait. |
cancellationToken | A cancellation token that should be used to cancel the work. |
|
inlinestatic |
Waits until the next server frame/loop.
|
inlinestatic |
Queues the specified work to run on the next server cycle.
function | The task to run. |
|
inlinestatic |
Safely returns to a NWScript context from another thread.
This must ALWAYS be called after an external callback, or thread switch before using any NWN APIs.
|
inlinestatic |
Waits until the specified expression returns true.
test | The test expression. |
cancellationToken | A cancellation token that should be used to cancel the work. |
|
inlinestatic |
Waits until the specified value source changes.
valueSource | The watched value source. |
cancellationToken | A cancellation token that should be used to cancel the work. |
|
inlinestatic |
Waits until all the specified tasks have completed.
tasks | The tasks to wait on for completion. |
|
inlinestatic |
Waits until any of the specified tasks have completed.
NOTE: This will not cancel other tasks that have not finished running. Specify a common CancellationToken in each of the source tasks.
tasks | The tasks to wait on for completion. |