PoolThrottler

Default throttler implementation used if no external one is supplied via constructor. It throttles on amount of busy tasks in internal task pool.

Constructors

this
this(IPoolInfo pool, size_t suspend_point, size_t resume_point)

Constructor

Members

Functions

resume
bool resume()

Check if the total number of active tasks is below the desired limit to resume.

suspend
bool suspend()

Check if the total number of active tasks has reached the desired limit to suspend.

Variables

pool
IPoolInfo pool;

Reference to the throttled pool

resume_point
size_t resume_point;

When amount of total queued tasks is <= this value, the input will be resumed.

suspend_point
size_t suspend_point;

When amount of total queued tasks is >= this value, the input will be suspended.

Inherited Members

From ISuspendableThrottler

addSuspendable
void addSuspendable(ISuspendable s)

Adds a suspendable to the list of suspendables which are to be throttled if it's not already in there. Also ensures that the state of the added suspendable is consistent with the state of the throttler.

removeSuspendable
void removeSuspendable(ISuspendable s)

Removes a suspendable from the list of suspendables if it exists.

suspended
bool suspended()
clear
void clear()

Clears the list of suspendables.

throttledSuspend
void throttledSuspend()

Checks if the suspend limit has been reached and the suspendables need to be suspended.

throttledResume
void throttledResume()

Checks if resume limit has been reached and the suspendables need to be resumed.

suspend
bool suspend()

Decides whether the suspendables should be suspended. Called by throttledSuspend() when not suspended.

resume
bool resume()

Decides whether the suspendables should be resumed. Called by throttledResume() when suspended.

Meta