21 static std::atomic_uint_fast16_t counter(0);
23 std::uint_fast16_t new_value;
24 std::uint_fast16_t current;
28 if (current == std::numeric_limits<std::uint16_t>::max())
35 new_value =
static_cast<std::uint_fast16_t
>(current + 1);
38 while (!counter.compare_exchange_weak(current, new_value));
40 return std::make_tuple(static_cast<std::uint8_t>(new_value >> 8),
41 static_cast<std::uint8_t>(new_value));
static std::tuple< uint8_t, uint8_t > getNext()
Returns the next request number.