4 * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue
6 * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * Copyright 2011-2012 - Lai Jiangshan <laijs@cn.fujitsu.com>
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.
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.
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
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"
29 * library wrappers to be used by non-LGPL compatible source code.
32 void cds_wfcq_node_init(struct cds_wfcq_node
*node
)
34 _cds_wfcq_node_init(node
);
37 void cds_wfcq_init(struct cds_wfcq_head
*head
,
38 struct cds_wfcq_tail
*tail
)
40 _cds_wfcq_init(head
, tail
);
43 void cds_wfcq_destroy(struct cds_wfcq_head
*head
,
44 struct cds_wfcq_tail
*tail
)
46 _cds_wfcq_destroy(head
, tail
);
49 void __cds_wfcq_init(struct __cds_wfcq_head
*head
,
50 struct cds_wfcq_tail
*tail
)
52 ___cds_wfcq_init(head
, tail
);
55 bool cds_wfcq_empty(cds_wfcq_head_ptr_t head
,
56 struct cds_wfcq_tail
*tail
)
59 return _cds_wfcq_empty(head
, tail
);
62 bool cds_wfcq_enqueue(cds_wfcq_head_ptr_t head
,
63 struct cds_wfcq_tail
*tail
,
64 struct cds_wfcq_node
*node
)
66 return _cds_wfcq_enqueue(head
, tail
, node
);
69 void cds_wfcq_dequeue_lock(struct cds_wfcq_head
*head
,
70 struct cds_wfcq_tail
*tail
)
72 _cds_wfcq_dequeue_lock(head
, tail
);
75 void cds_wfcq_dequeue_unlock(struct cds_wfcq_head
*head
,
76 struct cds_wfcq_tail
*tail
)
78 _cds_wfcq_dequeue_unlock(head
, tail
);
81 struct cds_wfcq_node
*cds_wfcq_dequeue_blocking(
82 struct cds_wfcq_head
*head
,
83 struct cds_wfcq_tail
*tail
)
85 return _cds_wfcq_dequeue_blocking(head
, tail
);
88 struct cds_wfcq_node
*cds_wfcq_dequeue_with_state_blocking(
89 struct cds_wfcq_head
*head
,
90 struct cds_wfcq_tail
*tail
,
93 return _cds_wfcq_dequeue_with_state_blocking(head
, tail
, state
);
96 enum cds_wfcq_ret
cds_wfcq_splice_blocking(
97 struct cds_wfcq_head
*dest_q_head
,
98 struct cds_wfcq_tail
*dest_q_tail
,
99 struct cds_wfcq_head
*src_q_head
,
100 struct cds_wfcq_tail
*src_q_tail
)
102 return _cds_wfcq_splice_blocking(dest_q_head
, dest_q_tail
,
103 src_q_head
, src_q_tail
);
106 struct cds_wfcq_node
*__cds_wfcq_dequeue_blocking(
107 cds_wfcq_head_ptr_t head
,
108 struct cds_wfcq_tail
*tail
)
110 return ___cds_wfcq_dequeue_blocking(head
, tail
);
113 struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_blocking(
114 cds_wfcq_head_ptr_t head
,
115 struct cds_wfcq_tail
*tail
,
118 return ___cds_wfcq_dequeue_with_state_blocking(head
, tail
, state
);
121 struct cds_wfcq_node
*__cds_wfcq_dequeue_nonblocking(
122 cds_wfcq_head_ptr_t head
,
123 struct cds_wfcq_tail
*tail
)
125 return ___cds_wfcq_dequeue_nonblocking(head
, tail
);
128 struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_nonblocking(
129 cds_wfcq_head_ptr_t head
,
130 struct cds_wfcq_tail
*tail
,
133 return ___cds_wfcq_dequeue_with_state_nonblocking(head
, tail
, state
);
136 enum cds_wfcq_ret
__cds_wfcq_splice_blocking(
137 cds_wfcq_head_ptr_t dest_q_head
,
138 struct cds_wfcq_tail
*dest_q_tail
,
139 cds_wfcq_head_ptr_t src_q_head
,
140 struct cds_wfcq_tail
*src_q_tail
)
142 return ___cds_wfcq_splice_blocking(dest_q_head
, dest_q_tail
,
143 src_q_head
, src_q_tail
);
146 enum cds_wfcq_ret
__cds_wfcq_splice_nonblocking(
147 cds_wfcq_head_ptr_t dest_q_head
,
148 struct cds_wfcq_tail
*dest_q_tail
,
149 cds_wfcq_head_ptr_t src_q_head
,
150 struct cds_wfcq_tail
*src_q_tail
)
152 return ___cds_wfcq_splice_nonblocking(dest_q_head
, dest_q_tail
,
153 src_q_head
, src_q_tail
);
156 struct cds_wfcq_node
*__cds_wfcq_first_blocking(
157 cds_wfcq_head_ptr_t head
,
158 struct cds_wfcq_tail
*tail
)
160 return ___cds_wfcq_first_blocking(head
, tail
);
163 struct cds_wfcq_node
*__cds_wfcq_first_nonblocking(
164 cds_wfcq_head_ptr_t head
,
165 struct cds_wfcq_tail
*tail
)
167 return ___cds_wfcq_first_nonblocking(head
, tail
);
170 struct cds_wfcq_node
*__cds_wfcq_next_blocking(
171 cds_wfcq_head_ptr_t head
,
172 struct cds_wfcq_tail
*tail
,
173 struct cds_wfcq_node
*node
)
175 return ___cds_wfcq_next_blocking(head
, tail
, node
);
178 struct cds_wfcq_node
*__cds_wfcq_next_nonblocking(
179 cds_wfcq_head_ptr_t head
,
180 struct cds_wfcq_tail
*tail
,
181 struct cds_wfcq_node
*node
)
183 return ___cds_wfcq_next_nonblocking(head
, tail
, node
);