SpinUntil Method (Func(Boolean), Int32)

Task Parallel System.Threading

Spins until the specified condition is satisfied or until the specified timeout is expired.

Namespace:  System.Threading
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function SpinUntil ( _
	condition As Func(Of Boolean), _
	millisecondsTimeout As Integer _
) As Boolean
C#
public static bool SpinUntil(
	Func<bool> condition,
	int millisecondsTimeout
)

Parameters

condition
Type: System..::.Func<(Of <(Boolean>)>)
A delegate to be executed over and over until it returns true.
millisecondsTimeout
Type: System..::.Int32
The number of milliseconds to wait, or Infinite (-1) to wait indefinitely.

Return Value

True if the condition is satisfied within the timeout; otherwise, false

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionThe condition argument is null.
System..::.ArgumentOutOfRangeExceptionmillisecondsTimeout is a negative number other than -1, which represents an infinite time-out.

See Also