24 #ifndef GRAPHLAB_ATOMIC_OPS_HPP
25 #define GRAPHLAB_ATOMIC_OPS_HPP
46 return __sync_bool_compare_and_swap(&a, oldval, newval);
66 return __sync_bool_compare_and_swap(&a, oldval, newval);
86 volatile uint64_t* a_ptr =
reinterpret_cast<volatile uint64_t*
>(&a);
87 const uint64_t* oldval_ptr =
reinterpret_cast<const uint64_t*
>(&oldval);
88 const uint64_t* newval_ptr =
reinterpret_cast<const uint64_t*
>(&newval);
89 return __sync_bool_compare_and_swap(a_ptr, *oldval_ptr, *newval_ptr);
109 volatile uint32_t* a_ptr =
reinterpret_cast<volatile uint32_t*
>(&a);
110 const uint32_t* oldval_ptr =
reinterpret_cast<const uint32_t*
>(&oldval);
111 const uint32_t* newval_ptr =
reinterpret_cast<const uint32_t*
>(&newval);
112 return __sync_bool_compare_and_swap(a_ptr, *oldval_ptr, *newval_ptr);
123 b = __sync_lock_test_and_set(&a, b);
134 b = __sync_lock_test_and_set(&a, b);
143 return __sync_lock_test_and_set(&a, newval);