Go to the documentation of this file. 1 #ifndef _XRDSYSATOMICS_
2 #define _XRDSYSATOMICS_
21 #define AtomicBeg(Mtx)
22 #define AtomicEnd(Mtx)
23 #define AtomicAdd(x, y) __sync_fetch_and_add(&x, y)
24 #define AtomicCAS(x, y, z) __sync_bool_compare_and_swap(&x, y, z)
25 #define AtomicDec(x) __sync_fetch_and_sub(&x, 1)
26 #define AtomicDTZ(x) if (!(__sync_fetch_and_sub(&x, 1))) AtomicFAZ(x)
27 #define AtomicFAZ(x) __sync_fetch_and_and(&x, 0)
28 #define AtomicGet(x) __sync_fetch_and_or(&x, 0)
29 #define AtomicInc(x) __sync_fetch_and_add(&x, 1)
30 #define AtomicISM(x, y) if (AtomicGet(y) <= AtomicInc(x)) AtomicCAS(y, y, x)
31 #define AtomicSub(x, y) __sync_fetch_and_sub(&x, y)
33 #define AtomicBeg(Mtx) Mtx.Lock()
34 #define AtomicEnd(Mtx) Mtx.UnLock()
35 #define AtomicAdd(x, y) x += y
36 #define AtomicCAS(x, y, z) if (x == y) x = z
37 #define AtomicDTZ(x) if (!(x--)) x = 0
38 #define AtomicDec(x) x--
39 #define AtomicFAZ(x) x; x = 0
40 #define AtomicGet(x) x
41 #define AtomicInc(x) x++
42 #define AtomicISM(x, y) if (y == x++) y = x
43 #define AtomicSub(x, y) x -= y