Platform-specific C implementation of atomic variables.
More...
#include <stdint.h>
|
#define | OC_ATOMIC_COMPARE_AND_SWAP32(x, expected, desired, result) |
|
#define | OC_ATOMIC_COMPARE_AND_SWAP8(x, expected, desired, result) OC_ATOMIC_COMPARE_AND_SWAP32(x, expected, desired, result) |
|
#define | OC_ATOMIC_DECREMENT32(x) --(x) |
|
#define | OC_ATOMIC_INCREMENT32(x) ++(x) |
|
#define | OC_ATOMIC_INT32_T volatile int32_t |
|
#define | OC_ATOMIC_INT8_T volatile int8_t |
|
#define | OC_ATOMIC_LOAD32(x) (x) |
|
#define | OC_ATOMIC_LOAD8(x) OC_ATOMIC_LOAD32(x) |
|
#define | OC_ATOMIC_NOT_SUPPORTED |
|
#define | OC_ATOMIC_STORE32(x, val) (x) = (val) |
|
#define | OC_ATOMIC_STORE8(x, val) OC_ATOMIC_STORE32(x, val) |
|
#define | OC_ATOMIC_UINT32_T volatile uint32_t |
|
#define | OC_ATOMIC_UINT8_T volatile uint8_t |
|
Platform-specific C implementation of atomic variables.
- Author
- Daniel Adam
◆ OC_ATOMIC_COMPARE_AND_SWAP32
#define OC_ATOMIC_COMPARE_AND_SWAP32 |
( |
|
x, |
|
|
|
expected, |
|
|
|
desired, |
|
|
|
result |
|
) |
| |
Value: do { \
if ((x) == (expected)) { \
(x) = (desired); \
(result) = true; \
} else { \
(expected) = (x); \
(result) = false; \
} \
} while (0)