25 #ifndef TERVEL_UTIL_PADDEDATOMIC_H
26 #define TERVEL_UTIL_PADDEDATOMIC_H
40 T
load(std::memory_order memory_order = std::memory_order_seq_cst) {
41 return atomic.load(memory_order);
43 void store(T value, std::memory_order memory_order
44 = std::memory_order_seq_cst) {
45 atomic.store(value, memory_order);
48 T
exchange(T value, std::memory_order memory_order
49 = std::memory_order_seq_cst) {
50 return atomic.exchange(value, memory_order);
54 std::memory_order success, std::memory_order failure ) {
55 return atomic.compare_exchange_weak(expected, desired, success, failure);
59 std::memory_order order = std::memory_order_seq_cst ) {
60 return atomic.compare_exchange_weak(expected, desired, order);
64 std::memory_order success, std::memory_order failure ) {
65 return atomic.compare_exchange_strong(expected, desired, success, failure);
69 std::memory_order_seq_cst ) {
70 return atomic.compare_exchange_strong(expected, desired, order);
74 std::memory_order_seq_cst ) {
75 return atomic.fetch_add(arg, memory_order);
88 #endif // TERVEL_UTIL_PADDEDATOMIC_H
T load(std::memory_order memory_order=std::memory_order_seq_cst)
Definition: padded_atomic.h:40
void store(T value, std::memory_order memory_order=std::memory_order_seq_cst)
Definition: padded_atomic.h:43
bool compare_exchange_strong(T &expected, T desired, std::memory_order order=std::memory_order_seq_cst)
Definition: padded_atomic.h:68
TODO(steven):
Definition: mcas.h:36
bool compare_exchange_weak(T &expected, T desired, std::memory_order success, std::memory_order failure)
Definition: padded_atomic.h:53
T exchange(T value, std::memory_order memory_order=std::memory_order_seq_cst)
Definition: padded_atomic.h:48
Definition: padded_atomic.h:35
char padding[CACHE_LINE_SIZE-sizeof(std::atomic< T >)]
Definition: padded_atomic.h:81
PaddedAtomic(T value)
Definition: padded_atomic.h:38
#define CACHE_LINE_SIZE
Definition: system.h:41
T fetch_add(T arg, std::memory_order memory_order=std::memory_order_seq_cst)
Definition: padded_atomic.h:73
PaddedAtomic()
Definition: padded_atomic.h:37
bool compare_exchange_weak(T &expected, T desired, std::memory_order order=std::memory_order_seq_cst)
Definition: padded_atomic.h:58
bool compare_exchange_strong(T &expected, T desired, std::memory_order success, std::memory_order failure)
Definition: padded_atomic.h:63
std::atomic< T > atomic
Definition: padded_atomic.h:78