Add __rcu annotation (unimplemented)
[urcu.git] / urcu / rculfqueue.h
1 #ifndef _URCU_RCULFQUEUE_H
2 #define _URCU_RCULFQUEUE_H
3
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
26 #include <assert.h>
27 #include <urcu-call-rcu.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 struct cds_lfq_queue_rcu;
34
35 struct cds_lfq_node_rcu {
36 struct cds_lfq_node_rcu *next;
37 int dummy;
38 };
39
40 struct cds_lfq_queue_rcu {
41 struct cds_lfq_node_rcu *head, *tail;
42 };
43
44 #ifdef _LGPL_SOURCE
45
46 #include <urcu/static/rculfqueue.h>
47
48 #define cds_lfq_node_init_rcu_qsbr _cds_lfq_node_init_rcu
49 #define cds_lfq_init_rcu_qsbr _cds_lfq_init_rcu
50 #define cds_lfq_destroy_rcu_qsbr _cds_lfq_destroy_rcu
51 #define cds_lfq_enqueue_rcu_qsbr _cds_lfq_enqueue_rcu
52 #define cds_lfq_dequeue_rcu_qsbr _cds_lfq_dequeue_rcu
53
54 #define cds_lfq_node_init_rcu_bp _cds_lfq_node_init_rcu
55 #define cds_lfq_init_rcu_bp _cds_lfq_init_rcu
56 #define cds_lfq_destroy_rcu_bp _cds_lfq_destroy_rcu
57 #define cds_lfq_enqueue_rcu_bp _cds_lfq_enqueue_rcu
58 #define cds_lfq_dequeue_rcu_bp _cds_lfq_dequeue_rcu
59
60 #define cds_lfq_node_init_rcu_memb _cds_lfq_node_init_rcu
61 #define cds_lfq_init_rcu_memb _cds_lfq_init_rcu
62 #define cds_lfq_destroy_rcu_memb _cds_lfq_destroy_rcu
63 #define cds_lfq_enqueue_rcu_memb _cds_lfq_enqueue_rcu
64 #define cds_lfq_dequeue_rcu_memb _cds_lfq_dequeue_rcu
65
66 #define cds_lfq_node_init_rcu_mb _cds_lfq_node_init_rcu
67 #define cds_lfq_init_rcu_mb _cds_lfq_init_rcu
68 #define cds_lfq_destroy_rcu_mb _cds_lfq_destroy_rcu
69 #define cds_lfq_enqueue_rcu_mb _cds_lfq_enqueue_rcu
70 #define cds_lfq_dequeue_rcu_mb _cds_lfq_dequeue_rcu
71
72 #define cds_lfq_node_init_rcu_sig _cds_lfq_node_init_rcu
73 #define cds_lfq_init_rcu_sig _cds_lfq_init_rcu
74 #define cds_lfq_destroy_rcu_sig _cds_lfq_destroy_rcu
75 #define cds_lfq_enqueue_rcu_sig _cds_lfq_enqueue_rcu
76 #define cds_lfq_dequeue_rcu_sig _cds_lfq_dequeue_rcu
77
78 #else /* !_LGPL_SOURCE */
79
80 extern void cds_lfq_node_init_rcu(struct cds_lfq_node_rcu *node);
81 extern void cds_lfq_init_rcu(struct cds_lfq_queue_rcu *q);
82 /*
83 * The queue should be emptied before calling destroy.
84 *
85 * Return 0 on success, -EPERM if queue is not empty.
86 */
87 extern int cds_lfq_destroy_rcu(struct cds_lfq_queue_rcu *q);
88
89 /*
90 * Acts as a RCU reader.
91 */
92 extern void cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q,
93 struct cds_lfq_node_rcu *node);
94
95 /*
96 * Acts as a RCU reader.
97 *
98 * The caller must wait for a grace period to pass before freeing the returned
99 * node or modifying the cds_lfq_node_rcu structure.
100 * Returns NULL if queue is empty.
101 */
102 extern
103 struct cds_lfq_node_rcu *cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q);
104
105 #endif /* !_LGPL_SOURCE */
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif /* _URCU_RCULFQUEUE_H */
This page took 0.031641 seconds and 5 git commands to generate.