11 #ifndef __SYS_AtomicPtr__
12 #define __SYS_AtomicPtr__
29 : myValue(reinterpret_cast<ptrdiff_t>(
value))
44 T *
volatile * ptr_addr,
45 T *expected,
T *desired);
77 return reinterpret_cast<T *
>(
78 myValue.exchange(reinterpret_cast<ptrdiff_t>(val)));
85 return reinterpret_cast<T *
>(
87 reinterpret_cast<ptrdiff_t>(expected),
88 reinterpret_cast<ptrdiff_t>(desired)));
94 T *
volatile * ptr_addr, T *expected, T *desired)
96 T *old =
reinterpret_cast<T *
>(
98 reinterpret_cast<volatile ptrdiff_t *>(ptr_addr),
99 reinterpret_cast<ptrdiff_t>(expected),
100 reinterpret_cast<ptrdiff_t>(desired)));
102 return (old == expected);
105 template <
typename T>
108 return reinterpret_cast<T *
>(myValue.load());
T compare_and_swap(volatile T *addr, T oldval, T newval)
SYS_FORCE_INLINE void relaxedStore(T val)
T * compare_swap(T *expected, T *desired)
SYS_FORCE_INLINE T relaxedLoad() const
T * operator->() const
Uses T *() for atomic indirection.
static bool compare_exchange_strong(T *volatile *ptr_addr, T *expected, T *desired)
SYS_AtomicPtr(T *value=0)
void relaxedStore(T *val)