SpinWait.SpinUntil Method

Definition

Spins until the specified condition is satisfied.

Overloads

SpinUntil(Func<Boolean>)

Spins until the specified condition is satisfied.

SpinUntil(Func<Boolean>, Int32)

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

SpinUntil(Func<Boolean>, TimeSpan)

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

SpinUntil(Func<Boolean>)

Source:
SpinWait.cs
Source:
SpinWait.cs
Source:
SpinWait.cs

Spins until the specified condition is satisfied.

public static void SpinUntil (Func<bool> condition);

Parameters

condition
Func<Boolean>

A delegate to be executed over and over until it returns true.

Exceptions

The condition argument is null.

See also

Applies to

.NET 9 och andra versioner
Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

SpinUntil(Func<Boolean>, Int32)

Source:
SpinWait.cs
Source:
SpinWait.cs
Source:
SpinWait.cs

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

public static bool SpinUntil (Func<bool> condition, int millisecondsTimeout);

Parameters

condition
Func<Boolean>

A delegate to be executed over and over until it returns true.

millisecondsTimeout
Int32

The number of milliseconds to wait, or Infinite (-1) to wait indefinitely.

Returns

true if the condition is satisfied within the timeout; otherwise, false.

Exceptions

The condition argument is null.

millisecondsTimeout is a negative number other than -1, which represents an infinite time-out.

See also

Applies to

.NET 9 och andra versioner
Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

SpinUntil(Func<Boolean>, TimeSpan)

Source:
SpinWait.cs
Source:
SpinWait.cs
Source:
SpinWait.cs

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

public static bool SpinUntil (Func<bool> condition, TimeSpan timeout);

Parameters

condition
Func<Boolean>

A delegate to be executed over and over until it returns true.

timeout
TimeSpan

A TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.

Returns

true if the condition is satisfied within the timeout; otherwise, false.

Exceptions

The condition argument is null.

timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than Int32.MaxValue.

See also

Applies to

.NET 9 och andra versioner
Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0