|
static async Task | SpinWait (Func< bool > until, int pollMillis=10, int timeoutMillis=-1) |
| Wait for a predicate to become true via polling More...
|
|
static TaskAwaiter< bool > | GetAwaiter (this IScheduledTask task) |
| GetAwaiter on a scheduled task (allows you to await the task) More...
|
|
static Task< T > | QueueAsyncTask< T > (this ITaskScheduler scheduler, Func< T > func) |
| Queues an async task on the scheduler to result in an awaitable task Only use if you know what you're doing. Much of empeld is not async-safe More...
|
|
static Task | QueueAsyncTask (this ITaskScheduler scheduler, Action func) |
| Queues an async task on the scheduler to be an awaitable task Only use if you know what you're doing. Much of empeld is not async-safe More...
|
|
◆ GetAwaiter()
static TaskAwaiter<bool> pluginbase.Objects.Tasks.TaskEx.GetAwaiter |
( |
this IScheduledTask |
task | ) |
|
|
static |
GetAwaiter on a scheduled task (allows you to await the task)
- Returns
- The awaiter.
- Parameters
-
32 var tcs =
new TaskCompletionSource<bool>();
40 task.Finish += (t) => tcs.SetResult(
true);
43 return tcs.Task.GetAwaiter();
◆ QueueAsyncTask()
static Task pluginbase.Objects.Tasks.TaskEx.QueueAsyncTask |
( |
this ITaskScheduler |
scheduler, |
|
|
Action |
func |
|
) |
| |
|
static |
Queues an async task on the scheduler to be an awaitable task Only use if you know what you're doing. Much of empeld is not async-safe
- Returns
- The async task.
- Parameters
-
scheduler | Scheduler. |
func | Func. |
81 return QueueAsyncTask<bool>(scheduler, () => {
◆ QueueAsyncTask< T >()
Queues an async task on the scheduler to result in an awaitable task Only use if you know what you're doing. Much of empeld is not async-safe
- Returns
- The async task.
- Parameters
-
scheduler | Scheduler. |
func | Func. |
- Template Parameters
-
56 var tcs =
new TaskCompletionSource<T>();
58 scheduler.QueueAsync(() => {
61 tcs.SetResult(func());
◆ SpinWait()
static async Task pluginbase.Objects.Tasks.TaskEx.SpinWait |
( |
Func< bool > |
until, |
|
|
int |
pollMillis = 10 , |
|
|
int |
timeoutMillis = -1 |
|
) |
| |
|
static |
Wait for a predicate to become true via polling
- Returns
- The wait.
- Parameters
-
until | Until. |
pollMillis | Poll millis. |
timeoutMillis | Timeout millis. |
18 while(!until() && (timeoutMillis < 0 || totalWait < timeoutMillis))
20 await Task.Delay(pollMillis);
21 totalWait += pollMillis;
The documentation for this class was generated from the following file: