Exponential backoff algorithm. Backoff spins for first X ticks, then sleeps with a time that doubles every X ticks thereafter.
More...
#include <Backoff.h>
|
| | 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...
|
| |
Exponential backoff algorithm. Backoff spins for first X ticks, then sleeps with a time that doubles every X ticks thereafter.
| honey::lockfree::Backoff::Backoff |
( |
bool |
spin = true, |
|
|
Nanosec |
timeMin = 100_ns, |
|
|
Nanosec |
timeMax = 100_us, |
|
|
int |
tickThresh = 5 |
|
) |
| |
|
inline |
- Parameters
-
| spin | Whether spinning is enabled |
| timeMin | Min sleep time |
| timeMax | Max sleep time |
| tickThresh | Tick threshold used to determine whether to spin or sleep, and when to grow the sleep time. |
| 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: