Add ATOMIC_GET

This commit is contained in:
Nils O. Selåsdal
2014-09-01 22:19:54 +02:00
parent 44ecb1ea7a
commit db0d62c639
+5
View File
@@ -34,6 +34,11 @@
*/ */
#define UC_ATOMIC_INC(ptr) UC_ATOMIC_ADD((ptr), 1) #define UC_ATOMIC_INC(ptr) UC_ATOMIC_ADD((ptr), 1)
/**
* Atomically get the value of *ptr
* @return value of *ptr
*/
#define UC_ATOMIC_GET(ptr) UC_ATOMIC_ADD((ptr), 0)
/** /**
* Atomic Compare-And-Swap. If *ptr is oldval, write newwal to *ptr. * Atomic Compare-And-Swap. If *ptr is oldval, write newwal to *ptr.