24 static long Increment(
long volatile* var);
26 static long Decrement(
long volatile* var);
28 static int Add(
int volatile* var,
int add);
30 static int Or(
int volatile* var,
int value);
32 static int And(
int volatile* var,
int value);
34 static int Xor(
int volatile* var,
int value);
36 static int Exchange(
int volatile* dest,
int value);
40 static int CompareExchange(
int volatile* dest,
int exchange,
int comparand);
51 return __sync_add_and_fetch(var, 1);
60 return __sync_sub_and_fetch(var, 1);
69 return __sync_add_and_fetch(var, 1);
78 return __sync_sub_and_fetch(var, 1);
87 return __sync_fetch_and_add(var, add);
96 return __sync_fetch_and_or(var, add);
105 return __sync_fetch_and_and(var, add);
114 return __sync_fetch_and_xor(var, add);
123 return __sync_lock_test_and_set(dest, value);
132 return __sync_lock_test_and_set(dest, value);
141 return __sync_val_compare_and_swap(dest, comparand, exchange);
150 return __sync_val_compare_and_swap(dest, comparand, exchange);
Provides simple atomic operations on shared variables using gcc compiler builtins.
Definition interlocked.h:17
static int Xor(int volatile *var, int value)
interlocked xor
Definition interlocked.h:112
static void * ExchangePointer(void *volatile *dest, void *value)
interlocked exchange
Definition interlocked.h:130
static int Or(int volatile *var, int value)
interlocked or
Definition interlocked.h:94
static int Decrement(int volatile *var)
interlocked decrement
Definition interlocked.h:58
static int Add(int volatile *var, int add)
interlocked add
Definition interlocked.h:85
static int CompareExchange(int volatile *dest, int exchange, int comparand)
interlocked compare-exchange
Definition interlocked.h:139
static int And(int volatile *var, int value)
interlocked and
Definition interlocked.h:103
static void * CompareExchangePointer(void *volatile *dest, void *exchange, void *comparand)
interlocked exchange
Definition interlocked.h:148
static int Exchange(int volatile *dest, int value)
interlocked exchange
Definition interlocked.h:121
static int Increment(int volatile *var)
interlocked increment
Definition interlocked.h:49
Definition interlocked.h:15