Go to the documentation of this file. 1 #ifndef BOOST_DETAIL_ATOMIC_BASE_HPP
2 #define BOOST_DETAIL_ATOMIC_BASE_HPP
17 #include <boost/smart_ptr/detail/spinlock_pool.hpp>
19 #define BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
20 operator value_type(void) volatile const \
22 return load(memory_order_seq_cst); \
26 operator=(value_type v) volatile \
28 store(v, memory_order_seq_cst); \
29 return *const_cast<this_type *>(this); \
33 compare_exchange_strong( \
34 value_type & expected, \
36 memory_order order = memory_order_seq_cst) volatile \
38 return compare_exchange_strong(expected, desired, order, calculate_failure_order(order)); \
42 compare_exchange_weak( \
43 value_type & expected, \
45 memory_order order = memory_order_seq_cst) volatile \
47 return compare_exchange_weak(expected, desired, order, calculate_failure_order(order)); \
51 #define BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
53 operator++(int) volatile \
55 return fetch_add(1); \
59 operator++(void) volatile \
61 return fetch_add(1) + 1; \
65 operator--(int) volatile \
67 return fetch_sub(1); \
71 operator--(void) volatile \
73 return fetch_sub(1) - 1; \
77 operator+=(difference_type v) volatile \
79 return fetch_add(v) + v; \
83 operator-=(difference_type v) volatile \
85 return fetch_sub(v) - v; \
88 #define BOOST_ATOMIC_DECLARE_BIT_OPERATORS \
90 operator&=(difference_type v) volatile \
92 return fetch_and(v) & v; \
96 operator|=(difference_type v) volatile \
98 return fetch_or(v) | v; \
102 operator^=(difference_type v) volatile \
104 return fetch_xor(v) ^ v; \
107 #define BOOST_ATOMIC_DECLARE_POINTER_OPERATORS \
108 BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
109 BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
111 #define BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS \
112 BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
113 BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
114 BOOST_ATOMIC_DECLARE_BIT_OPERATORS \
133 template<
typename T,
typename C ,
unsigned int Size,
bool Sign>
144 memcpy(&
v_, &v, Size);
152 memcpy(
const_cast<char *
>(
v_), &v, Size);
161 memcpy(&v,
const_cast<const char *
>(
v_), Size);
174 if (memcmp(
const_cast<char *
>(
v_), &expected, Size) == 0) {
175 memcpy(
const_cast<char *
>(
v_), &desired, Size);
178 memcpy(&expected,
const_cast<char *
>(
v_), Size);
199 memcpy(&tmp,
const_cast<char *
>(
v_), Size);
201 memcpy(
const_cast<char *
>(
v_), &v, Size);
219 template<
typename T,
unsigned int Size,
bool Sign>
264 if (
v_ == expected) {
344 template<
typename T,
unsigned int Size,
bool Sign>
388 if (v_ == expected) {
402 return compare_exchange_strong(expected, desired, success_order, failure_order);
436 template<
unsigned int Size,
bool Sign>
479 if (v_ == expected) {
493 return compare_exchange_strong(expected, desired, success_order, failure_order);
detail::spinlock_pool< 0 >::scoped_lock guard_type
bool is_lock_free(void) const volatile
bool compare_exchange_strong(value_type &expected, value_type desired, memory_order, memory_order) volatile
detail::spinlock_pool< 0 >::scoped_lock guard_type
bool is_lock_free(void) const volatile
bool compare_exchange_weak(value_type &expected, value_type desired, memory_order success_order, memory_order failure_order) volatile
value_type fetch_add(difference_type v, memory_order=memory_order_seq_cst) volatile
void store(value_type v, memory_order=memory_order_seq_cst) volatile
#define BOOST_ATOMIC_DECLARE_BASE_OPERATORS
bool is_lock_free(void) const volatile
bool compare_exchange_weak(value_type &expected, value_type desired, memory_order success_order, memory_order failure_order) volatile
detail::spinlock_pool< 0 >::scoped_lock guard_type
void store(value_type v, memory_order=memory_order_seq_cst) volatile
base_atomic(const value_type &v)
void operator=(const base_atomic &)
ptrdiff_t difference_type
void store(value_type v, memory_order=memory_order_seq_cst) volatile
base_atomic(value_type v)
void store(value_type v, memory_order=memory_order_seq_cst) volatile
value_type fetch_xor(value_type v, memory_order=memory_order_seq_cst) volatile
value_type exchange(value_type v, memory_order=memory_order_seq_cst) volatile
value_type exchange(value_type v, memory_order=memory_order_seq_cst) volatile
detail::spinlock_pool< 0 >::scoped_lock guard_type
bool compare_exchange_weak(value_type &expected, value_type desired, memory_order success_order, memory_order failure_order) volatile
value_type load(memory_order=memory_order_seq_cst) const volatile
static memory_order calculate_failure_order(memory_order order)
#define BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
value_type fetch_and(value_type v, memory_order=memory_order_seq_cst) volatile
bool is_lock_free(void) const volatile
value_type load(memory_order=memory_order_seq_cst) const volatile
base_atomic(value_type v)
value_type exchange(value_type v, memory_order=memory_order_seq_cst) volatile
bool compare_exchange_strong(value_type &expected, value_type desired, memory_order, memory_order) volatile
value_type fetch_sub(difference_type v, memory_order=memory_order_seq_cst) volatile
bool compare_exchange_strong(value_type &expected, value_type desired, memory_order, memory_order) volatile
value_type load(memory_order=memory_order_seq_cst) volatile const
#define BOOST_ATOMIC_DECLARE_POINTER_OPERATORS
value_type fetch_sub(difference_type v, memory_order=memory_order_seq_cst) volatile
value_type fetch_add(difference_type v, memory_order=memory_order_seq_cst) volatile
value_type load(memory_order=memory_order_seq_cst) const volatile
bool compare_exchange_weak(value_type &expected, value_type desired, memory_order success_order, memory_order failure_order) volatile
base_atomic(value_type v)
value_type exchange(value_type v, memory_order=memory_order_seq_cst) volatile
bool compare_exchange_strong(value_type &expected, value_type desired, memory_order, memory_order) volatile
value_type fetch_or(value_type v, memory_order=memory_order_seq_cst) volatile
rosatomic
Author(s): Josh Faust
autogenerated on Wed Mar 2 2022 00:54:12