TaskExt.WaitWhile Method (Func(Boolean), Single, Action, CancellationToken)
Creates an awaitable task that blocks while 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 WaitWhile(
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
See Also
Reference
TaskExt Class
WaitWhile Overload
UltimateXR.Extensions.System.Threading Namespace