The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
atomic_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: 82266f72d8f657073a7733a11f127f4fa5ff4d95 $
20 *
21 * @file io/atomic_queue.h
22 * @brief Thread-safe queues.
23 *
24 * @copyright 2016 Alan DeKok (aland@freeradius.org)
25 */
26RCSIDH(atomic_queue_h, "$Id: 82266f72d8f657073a7733a11f127f4fa5ff4d95 $")
27
28#include <stdbool.h>
29
30#ifdef HAVE_STDATOMIC_H
31# include <stdatomic.h>
32#else
33# include <freeradius-devel/util/stdatomic.h>
34#endif
35#include <freeradius-devel/util/talloc.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
42
43fr_atomic_queue_t *fr_atomic_queue_alloc(TALLOC_CTX *ctx, size_t size);
46bool fr_atomic_queue_pop(fr_atomic_queue_t *aq, void **p_data);
48
49#ifdef WITH_VERIFY_PTR
50void fr_atomic_queue_verify(fr_atomic_queue_t *aq);
51#endif
52
53#ifndef NDEBUG
55#endif
56
57
58#ifdef __cplusplus
59}
60#endif
size_t size
The length of the queue.
Structure to hold the atomic 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.
size_t fr_atomic_queue_size(fr_atomic_queue_t *aq)
bool fr_atomic_queue_push(fr_atomic_queue_t *aq, void *data)
Push a pointer into the atomic queue.
void fr_atomic_queue_free(fr_atomic_queue_t **aq)
Free an atomic queue if it's not freed by ctx.
#define RCSIDH(h, id)
Definition build.h:486
static fr_atomic_queue_t ** aq
static fr_slen_t data
Definition value.h:1293