Honeycomb  0.1
Component-Model Framework
Classes | Public Member Functions | List of all members
honey::lockfree::Backoff Class Reference

Exponential backoff algorithm. Backoff spins for first X ticks, then sleeps with a time that doubles every X ticks thereafter. More...

#include <Backoff.h>

Public Member Functions

 Backoff (bool spin=true, Nanosec timeMin=100_ns, Nanosec timeMax=100_us, int tickThresh=5)
 
void inc (int ticks=1)
 Increase tick count by ticks. Increases the amount of time that backoff will wait. More...
 
void dec (int ticks=1)
 Decrease tick count by ticks. Decreases the amount of time that backoff will wait. More...
 
void wait ()
 Perform backoff, suspend thread. More...
 
void reset ()
 Reset backoff to initial state. More...
 

Detailed Description

Exponential backoff algorithm. Backoff spins for first X ticks, then sleeps with a time that doubles every X ticks thereafter.

Constructor & Destructor Documentation

honey::lockfree::Backoff::Backoff ( bool  spin = true,
Nanosec  timeMin = 100_ns,
Nanosec  timeMax = 100_us,
int  tickThresh = 5 
)
inline
Parameters
spinWhether spinning is enabled
timeMinMin sleep time
timeMaxMax sleep time
tickThreshTick threshold used to determine whether to spin or sleep, and when to grow the sleep time.

Member Function Documentation

void honey::lockfree::Backoff::dec ( int  ticks = 1)
inline

Decrease tick count by ticks. Decreases the amount of time that backoff will wait.

void honey::lockfree::Backoff::inc ( int  ticks = 1)
inline

Increase tick count by ticks. Increases the amount of time that backoff will wait.

void honey::lockfree::Backoff::reset ( )
inline

Reset backoff to initial state.

void honey::lockfree::Backoff::wait ( )
inline

Perform backoff, suspend thread.


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