TaskExt.WaitWhile Method (Func(Boolean), Int32, CancellationToken)

Creates an awaitable task that blocks while a condition is true, a timeout occurs or the task is canceled.

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

Syntax

C#

public static Task WaitWhile(
	Func<bool> condition,
	int timeout,
	CancellationToken ct = default
)


Parameters

 

condition
Type: System.Func(Boolean)
The condition that will perpetuate the block
timeout
Type: System.Int32
Timeout, in milliseconds
ct (Optional)
Type: System.Threading.CancellationToken
Optional cancellation token, to cancel the task

Return Value

Type: Task
Awaitable Task

Exceptions

ExceptionCondition
TimeoutExceptionThrown after [!:timeout] milliseconds

See Also

Reference

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