1 /* This header implements atomic operation locking helpers. */
2 #ifndef IN_OVS_ATOMIC_H
3 #error "This header should only be included indirectly via ovs-atomic.h."
6 #define OVS_ATOMIC_LOCKED_IMPL 1
8 void atomic_lock__(void *);
9 void atomic_unlock__(void *);
11 #define atomic_store_locked(DST, SRC) \
12 (atomic_lock__(DST), \
14 atomic_unlock__(DST), \
17 #define atomic_read_locked(SRC, DST) \
18 (atomic_lock__(SRC), \
20 atomic_unlock__(SRC), \
23 #define atomic_op_locked_add +=
24 #define atomic_op_locked_sub -=
25 #define atomic_op_locked_or |=
26 #define atomic_op_locked_xor ^=
27 #define atomic_op_locked_and &=
28 #define atomic_op_locked(RMW, OP, OPERAND, ORIG) \
29 (atomic_lock__(RMW), \
31 *(RMW) atomic_op_locked_##OP (OPERAND), \