Update docs
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
#ifndef UC_ATOMIC_H_
|
#ifndef UC_ATOMIC_H_
|
||||||
#define UC_ATOMIC_H_
|
#define UC_ATOMIC_H_
|
||||||
|
|
||||||
#ifdef __GNUC__
|
/** Atomic functions (macros). The ptr argument must be a pointer to
|
||||||
|
* an integer type.
|
||||||
|
* For gcc, see http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/_005f_005fsync-Builtins.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Atomically add val to *ptr
|
* Atomically add val to *ptr
|
||||||
@@ -11,7 +15,7 @@
|
|||||||
#define UC_ATOMIC_ADD(ptr, val) __sync_fetch_and_add((ptr), (val))
|
#define UC_ATOMIC_ADD(ptr, val) __sync_fetch_and_add((ptr), (val))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Atomically subtract val to *ptr
|
* Atomically subtract val from *ptr
|
||||||
* @return *ptr before the subtraction
|
* @return *ptr before the subtraction
|
||||||
*/
|
*/
|
||||||
#define UC_ATOMIC_SUB(ptr, val) __sync_fetch_and_add((ptr), -(val))
|
#define UC_ATOMIC_SUB(ptr, val) __sync_fetch_and_add((ptr), -(val))
|
||||||
@@ -30,8 +34,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UC_ATOMIC_CAS(p, 12,
|
* Atomic Compare-And-Swap. If *ptr is oldval, write newwal to *ptr.
|
||||||
* Compare-And-Swap. If *ptr is oldval, write newwal to *ptr.
|
|
||||||
* @return *ptr that was before the operation.
|
* @return *ptr that was before the operation.
|
||||||
*/
|
*/
|
||||||
#define UC_ATOMIC_CAS(ptr, oldval, newval) __sync_val_compare_and_swap((ptr), (oldval), (newval))
|
#define UC_ATOMIC_CAS(ptr, oldval, newval) __sync_val_compare_and_swap((ptr), (oldval), (newval))
|
||||||
|
|||||||
Reference in New Issue
Block a user