23 RCSID(
"$Id: 3884f1b2cdc916dc85c485aed9a5aa3c4dab76f8 $")
25 #include <freeradius-devel/io/atomic_queue.h>
26 #include <freeradius-devel/util/debug.h>
27 #include <freeradius-devel/util/talloc.h>
53 fprintf(stderr,
"usage: atomic_queue_test [OPTS]\n");
54 fprintf(stderr,
" -s size set queue size.\n");
55 fprintf(stderr,
" -x Debugging mode.\n");
60 int main(
int argc,
char *argv[])
71 while ((c = getopt(argc, argv,
"hs:tx")) != -1)
switch (c) {
96 if (
debug_lvl > 1) printf(
"Filling with %d\n", size);
102 for (i = 0; i < size; i++) {
107 fprintf(stderr,
"Failed pushing at %d\n", i);
113 printf(
"iteration %d\n", i);
126 fprintf(stderr,
"Pushed an entry past the end of the queue.");
142 for (i = 0; i < size; i++) {
144 fprintf(stderr,
"Failed popping at %d\n", i);
148 val = (intptr_t)
data;
149 if (val != (i +
OFFSET)) {
150 fprintf(stderr,
"Pop expected %d, got %d\n",
157 printf(
"iteration %d\n", i);
167 fprintf(stderr,
"Popped an entry past the end of the 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.
bool fr_atomic_queue_push(fr_atomic_queue_t *aq, void *data)
Push a pointer into the atomic queue.
void fr_atomic_queue_debug(fr_atomic_queue_t *aq, FILE *fp)
Dump an atomic queue.
Structure to hold the atomic queue.
int main(int argc, char *argv[])
static NEVER_RETURNS void usage(void)
void request_verify(UNUSED char const *file, UNUSED int line, UNUSED request_t *request)
#define NEVER_RETURNS
Should be placed before the function return type.
static fr_atomic_queue_t * aq
#define fr_exit_now(_x)
Exit without calling atexit() handlers, producing a log message in debug builds.
static TALLOC_CTX * autofree
#define talloc_autofree_context
The original function is deprecated, so replace it with our version.