Commit | Line | Data |
---|---|---|
8ad4ce58 MD |
1 | /* |
2 | * wfcqueue.c | |
3 | * | |
f878b49e | 4 | * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue |
8ad4ce58 MD |
5 | * |
6 | * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
7 | * Copyright 2011-2012 - Lai Jiangshan <laijs@cn.fujitsu.com> | |
8 | * | |
9 | * This library is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU Lesser General Public | |
11 | * License as published by the Free Software Foundation; either | |
12 | * version 2.1 of the License, or (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public | |
20 | * License along with this library; if not, write to the Free Software | |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
22 | */ | |
23 | ||
24 | /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */ | |
25 | #include "urcu/wfcqueue.h" | |
26 | #include "urcu/static/wfcqueue.h" | |
27 | ||
28 | /* | |
29 | * library wrappers to be used by non-LGPL compatible source code. | |
30 | */ | |
31 | ||
32 | void cds_wfcq_node_init(struct cds_wfcq_node *node) | |
33 | { | |
34 | _cds_wfcq_node_init(node); | |
35 | } | |
36 | ||
37 | void cds_wfcq_init(struct cds_wfcq_head *head, | |
38 | struct cds_wfcq_tail *tail) | |
39 | { | |
40 | _cds_wfcq_init(head, tail); | |
41 | } | |
42 | ||
93aee570 | 43 | void cds_wfcq_destroy(struct cds_wfcq_head *head, |
8ad4ce58 | 44 | struct cds_wfcq_tail *tail) |
93aee570 MD |
45 | { |
46 | _cds_wfcq_destroy(head, tail); | |
47 | } | |
8ad4ce58 | 48 | |
93aee570 MD |
49 | bool cds_wfcq_empty(struct cds_wfcq_head *head, |
50 | struct cds_wfcq_tail *tail) | |
8ad4ce58 MD |
51 | { |
52 | return _cds_wfcq_empty(head, tail); | |
53 | } | |
54 | ||
23773356 | 55 | bool cds_wfcq_enqueue(struct cds_wfcq_head *head, |
8ad4ce58 MD |
56 | struct cds_wfcq_tail *tail, |
57 | struct cds_wfcq_node *node) | |
58 | { | |
23773356 | 59 | return _cds_wfcq_enqueue(head, tail, node); |
8ad4ce58 MD |
60 | } |
61 | ||
62 | void cds_wfcq_dequeue_lock(struct cds_wfcq_head *head, | |
63 | struct cds_wfcq_tail *tail) | |
64 | { | |
852a17ad | 65 | _cds_wfcq_dequeue_lock(head, tail); |
8ad4ce58 MD |
66 | } |
67 | ||
68 | void cds_wfcq_dequeue_unlock(struct cds_wfcq_head *head, | |
69 | struct cds_wfcq_tail *tail) | |
70 | { | |
852a17ad | 71 | _cds_wfcq_dequeue_unlock(head, tail); |
8ad4ce58 MD |
72 | } |
73 | ||
74 | struct cds_wfcq_node *cds_wfcq_dequeue_blocking( | |
75 | struct cds_wfcq_head *head, | |
76 | struct cds_wfcq_tail *tail) | |
77 | { | |
78 | return _cds_wfcq_dequeue_blocking(head, tail); | |
79 | } | |
80 | ||
eec791af MD |
81 | struct cds_wfcq_node *cds_wfcq_dequeue_with_state_blocking( |
82 | struct cds_wfcq_head *head, | |
83 | struct cds_wfcq_tail *tail, | |
84 | int *state) | |
85 | { | |
86 | return _cds_wfcq_dequeue_with_state_blocking(head, tail, state); | |
87 | } | |
88 | ||
23773356 | 89 | enum cds_wfcq_ret cds_wfcq_splice_blocking( |
8ad4ce58 MD |
90 | struct cds_wfcq_head *dest_q_head, |
91 | struct cds_wfcq_tail *dest_q_tail, | |
92 | struct cds_wfcq_head *src_q_head, | |
93 | struct cds_wfcq_tail *src_q_tail) | |
94 | { | |
23773356 | 95 | return _cds_wfcq_splice_blocking(dest_q_head, dest_q_tail, |
8ad4ce58 MD |
96 | src_q_head, src_q_tail); |
97 | } | |
98 | ||
99 | struct cds_wfcq_node *__cds_wfcq_dequeue_blocking( | |
100 | struct cds_wfcq_head *head, | |
101 | struct cds_wfcq_tail *tail) | |
102 | { | |
103 | return ___cds_wfcq_dequeue_blocking(head, tail); | |
104 | } | |
105 | ||
eec791af MD |
106 | struct cds_wfcq_node *__cds_wfcq_dequeue_with_state_blocking( |
107 | struct cds_wfcq_head *head, | |
108 | struct cds_wfcq_tail *tail, | |
109 | int *state) | |
110 | { | |
111 | return ___cds_wfcq_dequeue_with_state_blocking(head, tail, state); | |
112 | } | |
113 | ||
47215721 MD |
114 | struct cds_wfcq_node *__cds_wfcq_dequeue_nonblocking( |
115 | struct cds_wfcq_head *head, | |
116 | struct cds_wfcq_tail *tail) | |
117 | { | |
118 | return ___cds_wfcq_dequeue_nonblocking(head, tail); | |
119 | } | |
120 | ||
eec791af MD |
121 | struct cds_wfcq_node *__cds_wfcq_dequeue_with_state_nonblocking( |
122 | struct cds_wfcq_head *head, | |
123 | struct cds_wfcq_tail *tail, | |
124 | int *state) | |
125 | { | |
126 | return ___cds_wfcq_dequeue_with_state_nonblocking(head, tail, state); | |
127 | } | |
128 | ||
23773356 | 129 | enum cds_wfcq_ret __cds_wfcq_splice_blocking( |
8ad4ce58 MD |
130 | struct cds_wfcq_head *dest_q_head, |
131 | struct cds_wfcq_tail *dest_q_tail, | |
132 | struct cds_wfcq_head *src_q_head, | |
133 | struct cds_wfcq_tail *src_q_tail) | |
134 | { | |
23773356 | 135 | return ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail, |
8ad4ce58 MD |
136 | src_q_head, src_q_tail); |
137 | } | |
138 | ||
23773356 | 139 | enum cds_wfcq_ret __cds_wfcq_splice_nonblocking( |
47215721 MD |
140 | struct cds_wfcq_head *dest_q_head, |
141 | struct cds_wfcq_tail *dest_q_tail, | |
142 | struct cds_wfcq_head *src_q_head, | |
143 | struct cds_wfcq_tail *src_q_tail) | |
144 | { | |
145 | return ___cds_wfcq_splice_nonblocking(dest_q_head, dest_q_tail, | |
146 | src_q_head, src_q_tail); | |
147 | } | |
148 | ||
8ad4ce58 MD |
149 | struct cds_wfcq_node *__cds_wfcq_first_blocking( |
150 | struct cds_wfcq_head *head, | |
151 | struct cds_wfcq_tail *tail) | |
152 | { | |
153 | return ___cds_wfcq_first_blocking(head, tail); | |
154 | } | |
155 | ||
47215721 MD |
156 | struct cds_wfcq_node *__cds_wfcq_first_nonblocking( |
157 | struct cds_wfcq_head *head, | |
158 | struct cds_wfcq_tail *tail) | |
159 | { | |
160 | return ___cds_wfcq_first_nonblocking(head, tail); | |
161 | } | |
162 | ||
8ad4ce58 MD |
163 | struct cds_wfcq_node *__cds_wfcq_next_blocking( |
164 | struct cds_wfcq_head *head, | |
165 | struct cds_wfcq_tail *tail, | |
166 | struct cds_wfcq_node *node) | |
167 | { | |
168 | return ___cds_wfcq_next_blocking(head, tail, node); | |
169 | } | |
47215721 MD |
170 | |
171 | struct cds_wfcq_node *__cds_wfcq_next_nonblocking( | |
172 | struct cds_wfcq_head *head, | |
173 | struct cds_wfcq_tail *tail, | |
174 | struct cds_wfcq_node *node) | |
175 | { | |
176 | return ___cds_wfcq_next_nonblocking(head, tail, node); | |
177 | } |