1 #ifndef __GCC_ORO_ARCH__ 2 #define __GCC_ORO_ARCH__ 4 #include "../../rtt-config.h" 14 #define ORO_ATOMIC_SETUP oro_atomic_set 15 #define ORO_ATOMIC_CLEANUP(a_int) 17 #define oro_atomic_read(a_int) ((a_int)->cnt) 19 #define oro_atomic_set(a_int,n) (((a_int)->cnt) = (n)) 26 (void)__sync_add_and_fetch(&a_int->
cnt, n);
34 (void)__sync_sub_and_fetch(&a_int->
cnt, n);
42 return !(__sync_sub_and_fetch(&a_int->
cnt, n));
50 (void)__sync_fetch_and_add(&a_int->
cnt, 1);
58 (void)__sync_fetch_and_sub(&a_int->
cnt, 1);
66 return !(__sync_sub_and_fetch(&a_int->
cnt, 1));
74 return !(__sync_add_and_fetch(&a_int->
cnt, 1));
80 #define oro_cmpxchg(ptr,o,n)\ 81 ((__typeof__(*(ptr)))__sync_val_compare_and_swap((ptr),(o),(n))) 84 #endif // __GCC_ORO_ARCH__ int oro_atomic_inc_and_test(oro_atomic_t *a)
Increment a atomically and test for zero.
void oro_atomic_inc(oro_atomic_t *a)
Increment a atomically.
volatile long oro_atomic_t
void oro_atomic_sub(int n, oro_atomic_t *a, int n)
Substract n from a.
int oro_atomic_dec_and_test(oro_atomic_t *a)
Decrement a atomically and test for zero.
int oro_atomic_sub_and_test(oro_atomic_t *a, int n)
Substract n from a and test for zero.
void oro_atomic_dec(oro_atomic_t *a)
Decrement a atomically.
Structure that contains an int for atomic operations.
void oro_atomic_add(oro_atomic_t *a, int n)
Add n to a.