cds  2.3.2
cds::backoff Namespace Reference

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_traitsDefault
 Default backoff strategy.
 
typedef exponential< exponential_const_traitsLockDefault
 Default back-off strategy for lock primitives.
 

Detailed Description

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:

struct backoff_strategy {
void operator()();
template <typename Predicate> bool operator()( Predicate pr );
void reset();
};

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:

struct predicate {
bool operator()();
};

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.

Typedef Documentation

◆ delay_of

template<unsigned int Timeout, class Duration = std::chrono::milliseconds>
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.


cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:15 by Doxygen 1.8.13