26 RCSIDH(atomic_queue_h,
"$Id: fb096dd9a62ff019c2dd770f854ec76775c3c2da $")
30 #ifdef HAVE_STDATOMIC_H
33 # include <freeradius-devel/util/stdatomic.h>
35 #include <freeradius-devel/util/talloc.h>
40 #define atomic_int64_t _Atomic(int64_t)
41 #define atomic_uint32_t _Atomic(uint32_t)
42 #define atomic_uint64_t _Atomic(uint64_t)
44 #define cas_incr(_store, _var) atomic_compare_exchange_strong_explicit(&_store, &_var, _var + 1, memory_order_release, memory_order_relaxed)
45 #define cas_decr(_store, _var) atomic_compare_exchange_strong_explicit(&_store, &_var, _var - 1, memory_order_release, memory_order_relaxed)
46 #define load(_var) atomic_load_explicit(&_var, memory_order_relaxed)
47 #define aquire(_var) atomic_load_explicit(&_var, memory_order_acquire)
48 #define store(_store, _var) atomic_store_explicit(&_store, _var, memory_order_release)
62 #ifdef WITH_VERIFY_PTR
Structure to hold the atomic queue.
bool fr_atomic_queue_pop(fr_atomic_queue_t *aq, void **p_data)
Pop a pointer from the atomic queue.
fr_atomic_queue_t * fr_atomic_queue_alloc(TALLOC_CTX *ctx, size_t size)
Create fixed-size atomic queue.
size_t fr_atomic_queue_size(fr_atomic_queue_t *aq)
bool fr_atomic_queue_push(fr_atomic_queue_t *aq, void *data)
Push a pointer into the atomic queue.
void fr_atomic_queue_free(fr_atomic_queue_t **aq)
Free an atomic queue if it's not freed by ctx.
void fr_atomic_queue_debug(fr_atomic_queue_t *aq, FILE *fp)
Dump an atomic queue.
static fr_atomic_queue_t * aq