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: cf5779c56e50ef4dd121cd6546bddc6c5fc21f05 $
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: cf5779c56e50ef4dd121cd6546bddc6c5fc21f05 $")
27
28#include <freeradius-devel/io/atomic_queue.h>
29#include <freeradius-devel/util/talloc.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35typedef struct fr_queue_s fr_queue_t;
36
37fr_queue_t *fr_queue_create(TALLOC_CTX *ctx, int size);
39
40bool fr_queue_push(fr_queue_t *fq, void *data) CC_HINT(nonnull);
41bool fr_queue_pop(fr_queue_t *fq, void **p_data) CC_HINT(nonnull);
42
43int fr_queue_size(fr_queue_t *fq) CC_HINT(nonnull);
45
47
48#ifndef NDEBUG
49void fr_queue_debug(FILE *fp, fr_queue_t *fq) CC_HINT(nonnull);
50#endif
51
52
53#ifdef __cplusplus
54}
55#endif
Structure to hold the atomic queue.
#define RCSIDH(h, id)
Definition build.h:507
static fr_atomic_queue_t ** aq
int size
size of the queue
Definition queue.c:37
void fr_queue_debug(FILE *fp, fr_queue_t *fq)
Dump a queue.
Definition queue.c:261
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
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:225
static fr_slen_t data
Definition value.h:1340
int nonnull(2, 5))