mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-25 08:33:38 +03:00
atomic: add atomic_load_sub_store
This commit is contained in:
parent
f1f4ec315a
commit
3cf19c6e5e
1 changed files with 7 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue