22 void exchange_if_lower(std::atomic<T>& reference, T t)
24 T original_value = reference.load();
25 while (t < original_value && !reference.compare_exchange_weak(original_value, t)) {}
30 void exchange_if_greater(std::atomic<T>& reference, T t)
32 T original_value = reference.load();
33 while (t > original_value && !reference.compare_exchange_weak(original_value, t)) {}
38 void exchange_multiply(std::atomic<T>& reference, T t)
40 T original_value = reference.load();
41 while (!reference.compare_exchange_weak(original_value, original_value * t)) {}
46 bool compare_exchange(std::atomic<T>& reference, T from, T to)
48 T original_value = from;
49 return reference.compare_exchange_strong(original_value, to);