25 template<
typename T,
typename D>
33 inline value_type add_and_fetch(
volatile value_type *value, D addend )
35 return __sync_add_and_fetch(value, addend);
38 inline value_type fetch_and_add(
volatile value_type *value, D addend )
40 return __sync_fetch_and_add(value, addend);
43 inline value_type fetch_and_increment(
volatile value_type *value)
45 return __sync_fetch_and_add(value, 1);
48 inline value_type fetch_and_decrement(
volatile value_type *value)
50 return __sync_fetch_and_sub(value, 1);
53 inline value_type fetch_and_store(
volatile value_type *value,
56 return __sync_lock_test_and_set(value, new_value);
59 inline bool compare_and_swap(
volatile value_type *value,
61 value_type comparand )
63 return __sync_bool_compare_and_swap(value, comparand, new_value);
66 inline value_type fetch(
const volatile value_type *value)
const volatile
78 return __sync_fetch_and_add(const_cast<value_type *>(value), 0);
81 inline value_type store_with_release(
volatile value_type *value,
TODO: Rename this file - func.h is stupid.