ISuspendableThrottlerCount

Abstract base class for suspendable throttlers which throttle based on a count of pending items of some kind.

Provides the following additional functionality: * An abstract length() method which determines the current count of pending items. * suspend() and resume() methods which suspend or resume the ISuspendables based on the count of pending items and the suspend and resume points defined in the constructor.

Constructors

this
this(size_t suspend_point, size_t resume_point)

Constructor.

Members

Functions

length
size_t length()
resume
bool resume()

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

suspend
bool suspend()

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

Variables

resume_point
const(size_t) resume_point;

When the number of pending items reaches this value or less, the suspendables will be resumed.

suspend_point
const(size_t) suspend_point;

When the number of pending items reaches this value or greater, the suspendables 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