|
cds
2.3.2
|
Delay back-off strategy. More...
#include <cds/algo/backoff_strategy.h>
Public Types | |
| typedef Traits | traits |
| Traits. | |
| typedef Traits::duration_type | duration_type |
Duration type (default std::chrono::milliseconds) | |
Public Member Functions | |
| delay () noexcept | |
Default ctor takes the timeout from traits::timeout. | |
| constexpr | delay (unsigned int nTimeout) noexcept |
Initializes timeout from nTimeout. | |
Delay back-off strategy.
Template arguments:
Duration - duration type, default is std::chrono::milliseconds Traits - a class that defines default timeout.Choosing the best value for th timeout is platform and application specific task. The default values for timeout is provided by Traits class that should timeout data member. There are two predefined Traits implementation:
delay_const_traits - defines timeout as a constant (enum). To change timeout you should recompile your application.delay_runtime_traits - specifies timeout as static data member that can be changed at runtime to tune the back-off strategy.You may use Traits template parameter to separate back-off implementations. For example, you may define two delay back-offs for 5 and 10 ms timeout: