Revert "CDS API: removal of rcu_read lock/unlock dep, removal of call_rcu argument...
[urcu.git] / urcu / rculfqueue.h
CommitLineData
c3f74cb2
MD
1#ifndef _URCU_RCULFQUEUE_H
2#define _URCU_RCULFQUEUE_H
3
453629a9
MD
4/*
5 * rculfqueue.h
6 *
7 * Userspace RCU library - Lock-Free RCU Queue
8 *
9 * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
453629a9 26#include <assert.h>
e17d9985 27#include <urcu-call-rcu.h>
453629a9 28
0e2e9380
MD
29#ifdef __cplusplus
30extern "C" {
31#endif
32
d9b52143
MD
33struct cds_lfq_queue_rcu;
34
16aa9ee8
DG
35struct cds_lfq_node_rcu {
36 struct cds_lfq_node_rcu *next;
fbdb32f6 37 int dummy;
453629a9
MD
38};
39
16aa9ee8 40struct cds_lfq_queue_rcu {
fbdb32f6 41 struct cds_lfq_node_rcu *head, *tail;
6e5f88cf
MD
42 void (*queue_call_rcu)(struct rcu_head *head,
43 void (*func)(struct rcu_head *head));
453629a9
MD
44};
45
3d02c34d 46#ifdef _LGPL_SOURCE
453629a9 47
af7c2dbe 48#include <urcu/static/rculfqueue.h>
453629a9 49
d4b99c01
MD
50#define cds_lfq_node_init_rcu_qsbr _cds_lfq_node_init_rcu
51#define cds_lfq_init_rcu_qsbr _cds_lfq_init_rcu
52#define cds_lfq_destroy_rcu_qsbr _cds_lfq_destroy_rcu
53#define cds_lfq_enqueue_rcu_qsbr _cds_lfq_enqueue_rcu
54#define cds_lfq_dequeue_rcu_qsbr _cds_lfq_dequeue_rcu
55
56#define cds_lfq_node_init_rcu_bp _cds_lfq_node_init_rcu
57#define cds_lfq_init_rcu_bp _cds_lfq_init_rcu
58#define cds_lfq_destroy_rcu_bp _cds_lfq_destroy_rcu
59#define cds_lfq_enqueue_rcu_bp _cds_lfq_enqueue_rcu
60#define cds_lfq_dequeue_rcu_bp _cds_lfq_dequeue_rcu
61
62#define cds_lfq_node_init_rcu_memb _cds_lfq_node_init_rcu
63#define cds_lfq_init_rcu_memb _cds_lfq_init_rcu
64#define cds_lfq_destroy_rcu_memb _cds_lfq_destroy_rcu
65#define cds_lfq_enqueue_rcu_memb _cds_lfq_enqueue_rcu
66#define cds_lfq_dequeue_rcu_memb _cds_lfq_dequeue_rcu
67
68#define cds_lfq_node_init_rcu_mb _cds_lfq_node_init_rcu
69#define cds_lfq_init_rcu_mb _cds_lfq_init_rcu
70#define cds_lfq_destroy_rcu_mb _cds_lfq_destroy_rcu
71#define cds_lfq_enqueue_rcu_mb _cds_lfq_enqueue_rcu
72#define cds_lfq_dequeue_rcu_mb _cds_lfq_dequeue_rcu
73
74#define cds_lfq_node_init_rcu_sig _cds_lfq_node_init_rcu
75#define cds_lfq_init_rcu_sig _cds_lfq_init_rcu
76#define cds_lfq_destroy_rcu_sig _cds_lfq_destroy_rcu
77#define cds_lfq_enqueue_rcu_sig _cds_lfq_enqueue_rcu
78#define cds_lfq_dequeue_rcu_sig _cds_lfq_dequeue_rcu
453629a9 79
3d02c34d 80#else /* !_LGPL_SOURCE */
453629a9 81
16aa9ee8 82extern void cds_lfq_node_init_rcu(struct cds_lfq_node_rcu *node);
6e5f88cf
MD
83extern void cds_lfq_init_rcu(struct cds_lfq_queue_rcu *q,
84 void queue_call_rcu(struct rcu_head *head,
85 void (*func)(struct rcu_head *head)));
e17d9985
MD
86/*
87 * The queue should be emptied before calling destroy.
88 *
89 * Return 0 on success, -EPERM if queue is not empty.
90 */
91extern int cds_lfq_destroy_rcu(struct cds_lfq_queue_rcu *q);
d9b52143
MD
92
93/*
6e5f88cf 94 * Should be called under rcu read lock critical section.
d9b52143
MD
95 */
96extern void cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q,
97 struct cds_lfq_node_rcu *node);
453629a9
MD
98
99/*
6e5f88cf 100 * Should be called under rcu read lock critical section.
d9b52143 101 *
e17d9985
MD
102 * The caller must wait for a grace period to pass before freeing the returned
103 * node or modifying the cds_lfq_node_rcu structure.
104 * Returns NULL if queue is empty.
453629a9 105 */
a34df756
MD
106extern
107struct cds_lfq_node_rcu *cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q);
453629a9 108
3d02c34d 109#endif /* !_LGPL_SOURCE */
c3f74cb2 110
0e2e9380
MD
111#ifdef __cplusplus
112}
113#endif
114
c3f74cb2 115#endif /* _URCU_RCULFQUEUE_H */
This page took 0.039499 seconds and 4 git commands to generate.