Lean
$LEAN_TAG$
|
Provides a CPU non-intensive means of waiting for more tokens to be available in ITokenBucket. This strategy should be the most commonly used as it either sleeps or yields the currently executing thread, allowing for other threads to execute while the current thread is blocked and waiting for new tokens to become available in the bucket for consumption. More...
Public Member Functions | |
ThreadSleepStrategy (int milliseconds) | |
Initializes a new instance of the ThreadSleepStrategy using the specified number of milliseconds for each Sleep invocation. More... | |
void | Sleep () |
Sleeps the current thread using the initialized number of milliseconds More... | |
Static Public Member Functions | |
static ISleepStrategy | Sleeping (int milliseconds) |
Gets an instance of ISleepStrategy that sleeps the current thread for the specified number of milliseconds More... | |
Static Public Attributes | |
static readonly ISleepStrategy | Yielding = new ThreadSleepStrategy(0) |
Gets an instance of ISleepStrategy that yields the current thread More... | |
Provides a CPU non-intensive means of waiting for more tokens to be available in ITokenBucket. This strategy should be the most commonly used as it either sleeps or yields the currently executing thread, allowing for other threads to execute while the current thread is blocked and waiting for new tokens to become available in the bucket for consumption.
Definition at line 26 of file ThreadSleepStrategy.cs.
QuantConnect.Util.RateLimit.ThreadSleepStrategy.ThreadSleepStrategy | ( | int | milliseconds | ) |
Initializes a new instance of the ThreadSleepStrategy using the specified number of milliseconds for each Sleep invocation.
milliseconds | The duration of time to sleep, in milliseconds |
Definition at line 47 of file ThreadSleepStrategy.cs.
|
static |
Gets an instance of ISleepStrategy that sleeps the current thread for the specified number of milliseconds
milliseconds | The duration of time to sleep, in milliseconds |
void QuantConnect.Util.RateLimit.ThreadSleepStrategy.Sleep | ( | ) |
Sleeps the current thread using the initialized number of milliseconds
Implements QuantConnect.Util.RateLimit.ISleepStrategy.
Definition at line 55 of file ThreadSleepStrategy.cs.
|
static |
Gets an instance of ISleepStrategy that yields the current thread
Definition at line 31 of file ThreadSleepStrategy.cs.