cds
2.3.2
|
Different backoff schemes. More...
Data Structures | |
class | delay |
Delay back-off strategy. More... | |
struct | delay_const_traits |
Constant traits for delay back-off strategy. More... | |
struct | delay_runtime_traits |
Runtime traits for delay back-off strategy. More... | |
struct | empty |
Empty backoff strategy. Do nothing. More... | |
class | exponential |
Exponential back-off. More... | |
struct | exponential_const_traits |
backoff::exponential const traits More... | |
struct | exponential_runtime_traits |
nackoff::exponential runtime traits More... | |
struct | hint |
Processor hint back-off. More... | |
struct | pause |
Random pause. More... | |
struct | yield |
Switch to another thread (yield). Good for thread preemption architecture. More... | |
Typedefs | |
template<unsigned int Timeout, class Duration = std::chrono::milliseconds> | |
using | delay_of = typename make_delay_of< Timeout, Duration >::type |
Delay back-off strategy, template version. More... | |
typedef exponential< exponential_const_traits > | Default |
Default backoff strategy. | |
typedef exponential< exponential_const_traits > | LockDefault |
Default back-off strategy for lock primitives. | |
Different backoff schemes.
Back-off schema may be used in lock-free algorithms when the algorithm cannot perform some action because a conflict with the other concurrent operation is encountered. In this case current thread can do another work or can call processor's performance hint.
The interface of back-off strategy is following:
operator()
operator calls back-off strategy's action. It is main part of back-off strategy.
Interruptible back-off template < typename Predicate > bool operator()( Predicate pr )
allows to interrupt back-off spinning if pr
predicate returns true
. Predicate
is a functor with the following interface:
reset()
function resets internal state of back-off strategy to initial state. It is required for some back-off strategies, for example, exponential back-off.
using cds::backoff::delay_of = typedef typename make_delay_of< Timeout, Duration >::type |
Delay back-off strategy, template version.
This is a simplified version of backoff::delay
class. Template parameter Timeout
sets a delay timeout of Duration
unit.