Lean  $LEAN_TAG$
QuantConnect.Util.RateLimit.ThreadSleepStrategy Class Reference

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...

Inheritance diagram for QuantConnect.Util.RateLimit.ThreadSleepStrategy:
[legend]

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ThreadSleepStrategy()

QuantConnect.Util.RateLimit.ThreadSleepStrategy.ThreadSleepStrategy ( int  milliseconds)

Initializes a new instance of the ThreadSleepStrategy using the specified number of milliseconds for each Sleep invocation.

Parameters
millisecondsThe duration of time to sleep, in milliseconds

Definition at line 47 of file ThreadSleepStrategy.cs.

Member Function Documentation

◆ Sleeping()

static ISleepStrategy QuantConnect.Util.RateLimit.ThreadSleepStrategy.Sleeping ( int  milliseconds)
static

Gets an instance of ISleepStrategy that sleeps the current thread for the specified number of milliseconds

Parameters
millisecondsThe duration of time to sleep, in milliseconds

◆ Sleep()

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.

Member Data Documentation

◆ Yielding

readonly ISleepStrategy QuantConnect.Util.RateLimit.ThreadSleepStrategy.Yielding = new ThreadSleepStrategy(0)
static

Gets an instance of ISleepStrategy that yields the current thread

Definition at line 31 of file ThreadSleepStrategy.cs.


The documentation for this class was generated from the following file: