atomic: add atomic_load_sub_store
This commit is contained in:
parent
f1f4ec315a
commit
3cf19c6e5e
@ -63,6 +63,13 @@
|
|||||||
type oldval = atomic_load_##short_type(a, ATOMIC_RELAXED); \
|
type oldval = atomic_load_##short_type(a, ATOMIC_RELAXED); \
|
||||||
type newval = oldval + inc; \
|
type newval = oldval + inc; \
|
||||||
atomic_store_##short_type(a, newval, ATOMIC_RELAXED); \
|
atomic_store_##short_type(a, newval, ATOMIC_RELAXED); \
|
||||||
|
} \
|
||||||
|
ATOMIC_INLINE void \
|
||||||
|
atomic_load_sub_store_##short_type(atomic_##short_type##_t *a, \
|
||||||
|
type inc) { \
|
||||||
|
type oldval = atomic_load_##short_type(a, ATOMIC_RELAXED); \
|
||||||
|
type newval = oldval - inc; \
|
||||||
|
atomic_store_##short_type(a, newval, ATOMIC_RELAXED); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user