29 pthread_mutex_t the_mutex;
36 (void) pthread_mutex_init(&the_mutex, NULL);
42 pthread_mutex_destroy(&the_mutex);
46 pthread_mutex_lock(&the_mutex);
51 pthread_mutex_unlock(&the_mutex);
56 template<
typename T,
typename D>
67 inline value_type add_and_fetch(
volatile value_type *value, D addend )
71 value_type ret= *value;
76 inline value_type fetch_and_add(
volatile value_type *value, D addend )
79 value_type ret= *value;
85 inline value_type fetch_and_increment(
volatile value_type *value)
88 value_type ret= *value;
94 inline value_type fetch_and_decrement(
volatile value_type *value)
97 value_type ret= *value;
103 inline value_type fetch_and_store(
volatile value_type *value,
104 value_type new_value )
107 value_type ret= *value;
113 inline bool compare_and_swap(
volatile value_type *value,
114 value_type new_value,
115 value_type comparand )
118 bool ret= (*value == comparand);
125 inline value_type fetch(
const volatile value_type *value)
const volatile
128 value_type ret= *value;
133 inline value_type store_with_release(
volatile value_type *value,
134 value_type new_value)
138 value_type ret= *value;
TODO: Rename this file - func.h is stupid.