The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
queue.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: 12e9e6d7e79e169f6e9360995ff9f5a523ec71be $
20 *
21 * @file io/queue.h
22 * @brief Thread-unsafe queues.
23 *
24 * @copyright 2016 Alan DeKok (aland@freeradius.org)
25 */
26RCSIDH(queue_h, "$Id: 12e9e6d7e79e169f6e9360995ff9f5a523ec71be $")
27
28#include <stdbool.h>
29#include <freeradius-devel/io/atomic_queue.h>
30#include <freeradius-devel/util/talloc.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36typedef struct fr_queue_s fr_queue_t;
37
38fr_queue_t *fr_queue_create(TALLOC_CTX *ctx, int size);
40
41bool fr_queue_push(fr_queue_t *fq, void *data) CC_HINT(nonnull);
42bool fr_queue_pop(fr_queue_t *fq, void **p_data) CC_HINT(nonnull);
43
44int fr_queue_size(fr_queue_t *fq) CC_HINT(nonnull);
46
48
49#ifndef NDEBUG
50void fr_queue_debug(fr_queue_t *fq, FILE *fp) CC_HINT(nonnull);
51#endif
52
53
54#ifdef __cplusplus
55}
56#endif
Structure to hold the atomic queue.
#define RCSIDH(h, id)
Definition build.h:484
static fr_atomic_queue_t * aq
int size
size of the queue
Definition queue.c:37
int fr_queue_size(fr_queue_t *fq)
get the size of a queue
Definition queue.c:127
bool fr_queue_pop(fr_queue_t *fq, void **p_data)
Pop a pointer from the queue.
Definition queue.c:107
fr_queue_t * fr_queue_create(TALLOC_CTX *ctx, int size)
Create a non-thread-safe queue.
Definition queue.c:51
fr_queue_t * fr_queue_resize(fr_queue_t *fq, int size)
Resize a queue, and copy the entries over.
Definition queue.c:158
void fr_queue_debug(fr_queue_t *fq, FILE *fp)
Dump a queue.
Definition queue.c:258
bool fr_queue_push(fr_queue_t *fq, void *data)
Push a pointer into the queue.
Definition queue.c:85
int fr_queue_num_elements(fr_queue_t *fq)
get the number of elements in a queue.
Definition queue.c:141
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.
Definition queue.c:222
static fr_slen_t data
Definition value.h:1265
int nonnull(2, 5))