6 #ifndef XENIUM_BACKOFF_HPP
7 #define XENIUM_BACKOFF_HPP
10 #include <xenium/detail/hardware.hpp>
24 void operator()() { detail::hardware_pause(); }
27 template <
unsigned Max>
28 struct exponential_backoff {
29 static_assert(Max > 0,
"Max must be greater than zero. If you don't want to backoff use the `no_backoff` class.");
32 for (
unsigned i = 0; i < count; ++i) {
33 detail::hardware_pause();
35 count = std::min(Max, count * 2);