25 RCSID(
"$Id: d548ba35be7ea8fa5baf0a68d3dddacbe6674101 $")
30 #include <freeradius-devel/util/debug.h>
31 #include <freeradius-devel/io/queue.h>
55 if (size <= 0)
return NULL;
64 fq = talloc_size(ctx,
sizeof(*fq) + (size - 1) *
sizeof(fq->
entry[0]));
67 talloc_set_name(fq,
"fr_queue_t");
69 memset(fq, 0,
sizeof(*fq) + (size - 1) *
sizeof(fq->
entry[0]));
89 if (fq->
num >= fq->
size)
return false;
111 if (fq->
num == 0)
return false;
165 if (size <= 0)
return NULL;
167 if (size <= fq->size)
return fq;
169 ctx = talloc_parent(fq);
238 for (i = 0; i < room; i++) {
262 fprintf(fp,
"FQ %p size %d, head %d, tail %d\n",
265 for (i = 0; i < fq->
size; i++) {
266 fprintf(fp,
"\t[%d] = { %p }\n",
bool fr_atomic_queue_pop(fr_atomic_queue_t *aq, void **p_data)
Pop a pointer from the atomic queue.
Structure to hold the atomic queue.
static fr_atomic_queue_t * aq
int fr_queue_size(fr_queue_t *fq)
get the size of a queue
bool fr_queue_pop(fr_queue_t *fq, void **p_data)
Pop a pointer from the queue.
int head
head of the queue
int size
size of the queue
int num
number of elements pushed into the queue
void * entry[1]
Array of queue data.
fr_queue_t * fr_queue_resize(fr_queue_t *fq, int size)
Resize a queue, and copy the entries over.
fr_queue_t * fr_queue_create(TALLOC_CTX *ctx, int size)
Create a non-thread-safe queue.
void fr_queue_debug(fr_queue_t *fq, FILE *fp)
Dump a queue.
bool fr_queue_push(fr_queue_t *fq, void *data)
Push a pointer into the queue.
int fr_queue_num_elements(fr_queue_t *fq)
get the number of elements in a queue.
int tail
tail of the queue
int fr_queue_localize_atomic(fr_queue_t *fq, fr_atomic_queue_t *aq)
Pull all entries from an atomic queue into our local queue.