#include <os/atomic.h>

os/atomic.h

@file <os/atomic.h> @brief Small header that helps write code that works with both C11 and C++11, or pre-C11 type declarations. @discussion The macros below allow to write code like this, that can be put in a header and will work with both C11 and C++11: <code> struct old_type { int atomic_field; } old_variable; os_atomic_std(atomic_fetch_add_explicit)( os_cast_to_atomic_pointer(&old_variable), 1, os_atomic_std(memory_order_relaxed)); </code>
includes: os/base.h, stdatomic.h
7 macros

macroOS_ATOMIC_USES_CXX

#define OS_ATOMIC_USES_CXX 0

macroOS_ATOMIC_STD

#define OS_ATOMIC_STD 

macroos_atomic_std

#define os_atomic_std(op) op

macroos_atomic

#define os_atomic(type) type volatile _Atomic

macroos_cast_to_atomic_pointer

#define os_cast_to_atomic_pointer(p) (__typeof__(*(p)) volatile _Atomic *)(uintptr_t)(p)

macroos_cast_to_nonatomic_pointer

#define os_cast_to_nonatomic_pointer(p) (os_atomic_basetypeof(p) *)(uintptr_t)(p)

macroos_atomic_basetypeof

#define os_atomic_basetypeof(p) __typeof__(atomic_load(os_cast_to_atomic_pointer(p)))