20 #ifndef KERNEL_ATOMIC_H 21 #define KERNEL_ATOMIC_H 23 #include "pedigree/kernel/compiler.h" 24 #include "pedigree/kernel/processor/types.h" 25 #include "pedigree/kernel/utilities/utility.h" 34 typename T,
bool bAllow = (is_integral<T>::value | is_pointer<T>::value)>
46 inline Atomic(T value = T()) : m_Atom(value)
71 #if !defined(TARGET_HAS_NO_ATOMICS) 72 return __sync_add_and_fetch(&m_Atom, x);
83 #if !defined(TARGET_HAS_NO_ATOMICS) 84 return __sync_sub_and_fetch(&m_Atom, x);
95 #if !defined(TARGET_HAS_NO_ATOMICS) 96 return __sync_or_and_fetch(&m_Atom, x);
107 #if !defined(TARGET_HAS_NO_ATOMICS) 108 return __sync_and_and_fetch(&m_Atom, x);
119 #if !defined(TARGET_HAS_NO_ATOMICS) 120 return __sync_xor_and_fetch(&m_Atom, x);
133 #if !defined(TARGET_HAS_NO_ATOMICS) 134 return __sync_bool_compare_and_swap(&m_Atom, oldVal, newVal);
136 if (m_Atom == oldVal)
146 inline operator T()
const 210 (oldVal) ? 1 : 0, (newVal) ? 1 : 0);
214 inline operator bool()
const
bool compareAndSwap(T oldVal, T newVal)
Atomic & operator=(const Atomic &x)
Atomic & operator=(const Atomic &x)
bool compareAndSwap(bool oldVal, bool newVal)