Provides support for spin-based waiting.
More...
|
static void | SpinUntil (Func< bool > condition) |
| Spins until the specified condition is satisfied. More...
|
|
static bool | SpinUntil (Func< bool > condition, TimeSpan timeout) |
| Spins until the specified condition is satisfied or until the specified timeout is expired. More...
|
|
static bool | SpinUntil (Func< bool > condition, int millisecondsTimeout) |
| Spins until the specified condition is satisfied or until the specified timeout is expired. More...
|
|
|
internal const int | YIELD_THRESHOLD = 10 |
|
internal const int | SLEEP_0_EVERY_HOW_MANY_TIMES = 5 |
|
internal const int | SLEEP_1_EVERY_HOW_MANY_TIMES = 20 |
|
|
int | Count [get] |
| Gets the number of times M:System.Threading.SpinWait.SpinOnce has been called on this instance. More...
|
|
bool | NextSpinWillYield [get] |
| Gets whether the next call to M:System.Threading.SpinWait.SpinOnce will yield the processor, triggering a forced context switch. More...
|
|
Provides support for spin-based waiting.
Definition at line 8 of file SpinWait.cs.
◆ Reset()
void System.Threading.SpinWait.Reset |
( |
| ) |
|
Resets the spin counter.
Definition at line 76 of file SpinWait.cs.
◆ SpinOnce()
void System.Threading.SpinWait.SpinOnce |
( |
| ) |
|
Performs a single spin.
Definition at line 48 of file SpinWait.cs.
◆ SpinUntil() [1/3]
static void System.Threading.SpinWait.SpinUntil |
( |
Func< bool > |
condition | ) |
|
|
static |
Spins until the specified condition is satisfied.
- Parameters
-
condition | A delegate to be executed over and over until it returns true. |
- Exceptions
-
T:System.ArgumentNullException | The condition argument is null. |
Definition at line 85 of file SpinWait.cs.
◆ SpinUntil() [2/3]
static bool System.Threading.SpinWait.SpinUntil |
( |
Func< bool > |
condition, |
|
|
TimeSpan |
timeout |
|
) |
| |
|
static |
Spins until the specified condition is satisfied or until the specified timeout is expired.
- Parameters
-
condition | A delegate to be executed over and over until it returns true. |
timeout | A T:System.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
-
T:System.ArgumentNullException | The condition argument is null. |
T:System.ArgumentOutOfRangeException | timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than F:System.Int32.MaxValue. |
Definition at line 98 of file SpinWait.cs.
◆ SpinUntil() [3/3]
static bool System.Threading.SpinWait.SpinUntil |
( |
Func< bool > |
condition, |
|
|
int |
millisecondsTimeout |
|
) |
| |
|
static |
Spins until the specified condition is satisfied or until the specified timeout is expired.
- Parameters
-
condition | A delegate to be executed over and over until it returns true. |
millisecondsTimeout | The number of milliseconds to wait, or F:System.Threading.Timeout.Infinite (-1) to wait indefinitely. |
- Returns
- True if the condition is satisfied within the timeout; otherwise, false
- Exceptions
-
T:System.ArgumentNullException | The condition argument is null. |
T:System.ArgumentOutOfRangeException | millisecondsTimeout is a negative number other than -1, which represents an infinite time-out. |
Definition at line 116 of file SpinWait.cs.
◆ Count
int System.Threading.SpinWait.Count |
|
get |
Gets the number of times M:System.Threading.SpinWait.SpinOnce has been called on this instance.
- Returns
- Returns an integer that represents the number of times M:System.Threading.SpinWait.SpinOnce has been called on this instance.
Definition at line 22 of file SpinWait.cs.
◆ NextSpinWillYield
bool System.Threading.SpinWait.NextSpinWillYield |
|
get |
Gets whether the next call to M:System.Threading.SpinWait.SpinOnce will yield the processor, triggering a forced context switch.
- Returns
- Whether the next call to M:System.Threading.SpinWait.SpinOnce will yield the processor, triggering a forced context switch.
Definition at line 34 of file SpinWait.cs.
The documentation for this struct was generated from the following file: