--- libelwix/inc/elwix/aring.h 2026/02/11 13:36:09 1.6 +++ libelwix/inc/elwix/aring.h 2026/02/13 17:09:32 1.6.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aring.h,v 1.6 2026/02/11 13:36:09 misho Exp $ +* $Id: aring.h,v 1.6.2.1 2026/02/13 17:09:32 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -62,6 +62,13 @@ typedef struct { int lrb_size; unsigned char *lrb_data; } lrbuf_t; +#define lrb_head(x) atomic_load_explicit((atomic_int*) &(x)->lrb_head, memory_order_relaxed) +#define lrb_tail(x) atomic_load_explicit((atomic_int*) &(x)->lrb_tail, memory_order_relaxed) +#define lrb_size(x) ((x)->lrb_size) +#define lrb_getb(x) ((x)->lrb_data) +#define lrb_hptr(x) ((x)->lrb_data + lrb_head((x))) +#define lrb_tptr(x) ((x)->lrb_data + lrb_tail((x))) +#define lrb_isrewind(x) (lrb_head((x)) < lrb_tail((x))) #define lrb_queued(x, r) do { \ u_int _h, _t; \ _t = atomic_load_explicit((atomic_int*) &(x)->lrb_tail, memory_order_acquire); \