47 return _value.load(std::memory_order_acquire);
55 _value.store(val, std::memory_order_release);
65 return _value.fetch_add(val, std::memory_order_acq_rel);
75 return _value.fetch_sub(val, std::memory_order_acq_rel);
90 return _value.compare_exchange_strong(expected, desired,
91 std::memory_order_acq_rel, std::memory_order_acquire);
100 return _value.exchange(desired, std::memory_order_acq_rel);
104 std::atomic<T> _value;
Atomic variable wrapping std::atomic<T>.
Definition atomic.h:26
bool compareAndSwap(T &expected, T desired)
Atomically compares and swaps.
Definition atomic.h:89
Atomic(T val=T{})
Constructs an Atomic with the given initial value.
Definition atomic.h:32
~Atomic()=default
Destructor.
T fetchAndAdd(T val)
Atomically adds val and returns the previous value.
Definition atomic.h:64
T exchange(T desired)
Atomically replaces the value and returns the previous one.
Definition atomic.h:99
void setValue(T val)
Stores a new value with release semantics.
Definition atomic.h:54
T fetchAndSub(T val)
Atomically subtracts val and returns the previous value.
Definition atomic.h:74
T value() const
Loads the current value with acquire semantics.
Definition atomic.h:46
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19