mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 14:02:05 -04:00
Make isc_refcount_current() atomically read the counter value (#46074)
This commit is contained in:
parent
2495de04a5
commit
abb8813a33
2 changed files with 12 additions and 3 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
4741. [bug] Make isc_refcount_current() atomically read the
|
||||
counter value. [RT #46074]
|
||||
|
||||
4740. [cleanup] Avoid triggering format-truncated warnings. [RT #46107]
|
||||
|
||||
4739. [cleanup] Address clang static analysis warnings. [RT #45952]
|
||||
|
|
|
|||
|
|
@ -104,11 +104,13 @@ typedef struct isc_refcount {
|
|||
#endif
|
||||
} isc_refcount_t;
|
||||
|
||||
#define isc_refcount_destroy(rp) REQUIRE((rp)->refs == 0)
|
||||
#define isc_refcount_current(rp) ((unsigned int)((rp)->refs))
|
||||
|
||||
#if defined(ISC_REFCOUNT_HAVESTDATOMIC)
|
||||
|
||||
#define isc_refcount_current(rp) \
|
||||
((unsigned int)(atomic_load_explicit(&(rp)->refs, \
|
||||
memory_order_relaxed)))
|
||||
#define isc_refcount_destroy(rp) REQUIRE(isc_refcount_current(rp) == 0)
|
||||
|
||||
#define isc_refcount_increment0(rp, tp) \
|
||||
do { \
|
||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||
|
|
@ -143,6 +145,10 @@ typedef struct isc_refcount {
|
|||
|
||||
#else /* ISC_REFCOUNT_HAVESTDATOMIC */
|
||||
|
||||
#define isc_refcount_current(rp) \
|
||||
((unsigned int)(isc_atomic_xadd(&(rp)->refs, 0)))
|
||||
#define isc_refcount_destroy(rp) REQUIRE(isc_refcount_current(rp) == 0)
|
||||
|
||||
#define isc_refcount_increment0(rp, tp) \
|
||||
do { \
|
||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||
|
|
|
|||
Loading…
Reference in a new issue