23RCSID(
"$Id: 1325db7eb7977919432cf2e47f0a279a550b6249 $")
25#include <freeradius-devel/io/atomic_queue.h>
26#include <freeradius-devel/util/debug.h>
51 fprintf(stderr,
"usage: atomic_queue_test [OPTS]\n");
52 fprintf(stderr,
" -s size set queue size.\n");
53 fprintf(stderr,
" -x Debugging mode.\n");
58int main(
int argc,
char *argv[])
69 while ((c = getopt(argc, argv,
"hs:tx")) != -1)
switch (c) {
94 if (
debug_lvl > 1) printf(
"Filling with %d\n", size);
100 for (i = 0; i < size; i++) {
105 fprintf(stderr,
"Failed pushing at %d\n", i);
111 printf(
"iteration %d\n", i);
124 fprintf(stderr,
"Pushed an entry past the end of the queue.");
140 for (i = 0; i < size; i++) {
142 fprintf(stderr,
"Failed popping at %d\n", i);
146 val = (intptr_t)
data;
147 if (val != (i +
OFFSET)) {
148 fprintf(stderr,
"Pop expected %d, got %d\n",
155 printf(
"iteration %d\n", i);
165 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.
void fr_atomic_queue_debug(FILE *fp, fr_atomic_queue_t *aq)
Dump an 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.
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)
static TALLOC_CTX * autofree
#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.
#define talloc_autofree_context
The original function is deprecated, so replace it with our version.