15 #ifndef ATOMICADJUSTGCCIMPL_H 16 #define ATOMICADJUSTGCCIMPL_H 18 #include "dtoolbase.h" 19 #include "selectThreadImpl.h" 21 #if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (defined(__clang__) && (__clang_major__ >= 3)) 27 class EXPCL_DTOOL AtomicAdjustGccImpl {
29 #if __GCC_ATOMIC_LONG_LOCK_FREE > __GCC_ATOMIC_INT_LOCK_FREE 31 typedef __attribute__ ((aligned (__SIZEOF_LONG__)))
long Integer;
33 typedef __attribute__ ((aligned (__SIZEOF_INT__)))
int Integer;
35 typedef void *UnalignedPointer;
36 typedef __attribute__ ((aligned (__SIZEOF_POINTER__))) UnalignedPointer Pointer;
38 INLINE
static void inc(TVOLATILE Integer &var);
39 INLINE
static bool dec(TVOLATILE Integer &var);
40 INLINE
static void add(TVOLATILE Integer &var, Integer delta);
41 INLINE
static Integer
set(TVOLATILE Integer &var, Integer new_value);
42 INLINE
static Integer
get(
const TVOLATILE Integer &var);
44 INLINE
static Pointer set_ptr(TVOLATILE Pointer &var, Pointer new_value);
45 INLINE
static Pointer get_ptr(
const TVOLATILE Pointer &var);
47 INLINE
static Integer compare_and_exchange(TVOLATILE Integer &mem,
51 INLINE
static Pointer compare_and_exchange_ptr(TVOLATILE Pointer &mem,
56 #include "atomicAdjustGccImpl.I" 58 #endif // HAVE_POSIX_THREADS