TaskExt.WaitUntil Method (Func(Boolean), Single, Action, CancellationToken)

Creates an awaitable task that blocks until a condition is true, waiting a certain amount of seconds at maximum. An optional action can be called if the task was cancelled or it timed out.

Namespace: UltimateXR.Extensions.System.Threading
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static Task WaitUntil(
	Func<bool> condition,
	float duration,
	Action cancelCallback = null,
	CancellationToken ct = default
)


Parameters

 

condition
Type: System.Func(Boolean)
The condition that will perpetuate the block
duration
Type: System.Single
The maximum amount of seconds to wait while the condition is true
cancelCallback (Optional)
Type: System.Action
Optional action to execute if the task was canceled or it timed out
ct (Optional)
Type: System.Threading.CancellationToken
Optional cancellation token, to cancel the task

Return Value

Type: Task
Awaitable Task

See Also

Reference

TaskExt Class
WaitUntil Overload
UltimateXR.Extensions.System.Threading Namespace