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), _
timeout As TimeSpan _
) As Boolean |
C# |
---|
public static bool SpinUntil(
Func<bool> condition,
TimeSpan timeout
) |
Parameters
- condition
- Type: System..::.Func<(Of <(Boolean>)>)
A delegate to be executed over and over until it returns true.
- timeout
- Type: System..::.TimeSpan
A TimeSpan that represents the number of milliseconds to wait,
or a TimeSpan that represents -1 milliseconds to wait indefinitely.
Return Value
True if the condition is satisfied within the timeout; otherwise, false
Exceptions
Exception | Condition |
---|
System..::.ArgumentNullException | The condition argument is null. |
System..::.ArgumentOutOfRangeException | timeout is a negative number
other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than
MaxValue. |
See Also