mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 22:45:39 +00:00
Merge branch '2096-isc_refcount_decrement-needs-acquire-release-memory-ordering' into 'main'
Resolve "isc_refcount_decrement needs acquire release memory ordering." Closes #2096 See merge request isc-projects/bind9!4010
This commit is contained in:
@@ -65,6 +65,8 @@
|
|||||||
atomic_fetch_or_explicit((o), (v), memory_order_release)
|
atomic_fetch_or_explicit((o), (v), memory_order_release)
|
||||||
#define atomic_exchange_acq_rel(o, v) \
|
#define atomic_exchange_acq_rel(o, v) \
|
||||||
atomic_exchange_explicit((o), (v), memory_order_acq_rel)
|
atomic_exchange_explicit((o), (v), memory_order_acq_rel)
|
||||||
|
#define atomic_fetch_sub_acq_rel(o, v) \
|
||||||
|
atomic_fetch_sub_explicit((o), (v), memory_order_acq_rel)
|
||||||
#define atomic_compare_exchange_weak_acq_rel(o, e, d) \
|
#define atomic_compare_exchange_weak_acq_rel(o, e, d) \
|
||||||
atomic_compare_exchange_weak_explicit( \
|
atomic_compare_exchange_weak_explicit( \
|
||||||
(o), (e), (d), memory_order_acq_rel, memory_order_acquire)
|
(o), (e), (d), memory_order_acq_rel, memory_order_acquire)
|
||||||
|
@@ -118,7 +118,7 @@ isc_refcount_increment(isc_refcount_t *target) {
|
|||||||
static inline uint_fast32_t
|
static inline uint_fast32_t
|
||||||
isc_refcount_decrement(isc_refcount_t *target) {
|
isc_refcount_decrement(isc_refcount_t *target) {
|
||||||
uint_fast32_t __v;
|
uint_fast32_t __v;
|
||||||
__v = (uint_fast32_t)atomic_fetch_sub_release(target, 1);
|
__v = (uint_fast32_t)atomic_fetch_sub_acq_rel(target, 1);
|
||||||
INSIST(__v > 0);
|
INSIST(__v > 0);
|
||||||
return (__v);
|
return (__v);
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ isc_refcount_decrement(isc_refcount_t *target) {
|
|||||||
({ \
|
({ \
|
||||||
/* cppcheck-suppress shadowVariable */ \
|
/* cppcheck-suppress shadowVariable */ \
|
||||||
uint_fast32_t __v; \
|
uint_fast32_t __v; \
|
||||||
__v = atomic_fetch_sub_release(target, 1); \
|
__v = atomic_fetch_sub_acq_rel(target, 1); \
|
||||||
INSIST(__v > 0); \
|
INSIST(__v > 0); \
|
||||||
__v; \
|
__v; \
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user