23template <
typename T,
typename Func>
25 T old_value = atomic.load();
28 const T new_value = updater(T{old_value});
31 if (old_value == new_value)
return old_value;
33 if (atomic.compare_exchange_weak(old_value, new_value))
return new_value;
44 return utils::AtomicUpdate(atomic, [value](T old_value) {
45 return value < old_value ? value : old_value;
56 return utils::AtomicUpdate(atomic, [value](T old_value) {
57 return old_value < value ? value : old_value;