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_init(struct __cds_wfcq_head
*head
,
44 struct cds_wfcq_tail
*tail
)
46 ___cds_wfcq_init(head
, tail
);
49 bool cds_wfcq_empty(cds_wfcq_head_ptr_t head
,
50 struct cds_wfcq_tail
*tail
)
53 return _cds_wfcq_empty(head
, tail
);
56 bool cds_wfcq_enqueue(cds_wfcq_head_ptr_t head
,
57 struct cds_wfcq_tail
*tail
,
58 struct cds_wfcq_node
*node
)
60 return _cds_wfcq_enqueue(head
, tail
, node
);
63 void cds_wfcq_dequeue_lock(struct cds_wfcq_head
*head
,
64 struct cds_wfcq_tail
*tail
)
66 _cds_wfcq_dequeue_lock(head
, tail
);
69 void cds_wfcq_dequeue_unlock(struct cds_wfcq_head
*head
,
70 struct cds_wfcq_tail
*tail
)
72 _cds_wfcq_dequeue_unlock(head
, tail
);
75 struct cds_wfcq_node
*cds_wfcq_dequeue_blocking(
76 struct cds_wfcq_head
*head
,
77 struct cds_wfcq_tail
*tail
)
79 return _cds_wfcq_dequeue_blocking(head
, tail
);
82 struct cds_wfcq_node
*cds_wfcq_dequeue_with_state_blocking(
83 struct cds_wfcq_head
*head
,
84 struct cds_wfcq_tail
*tail
,
87 return _cds_wfcq_dequeue_with_state_blocking(head
, tail
, state
);
90 enum cds_wfcq_ret
cds_wfcq_splice_blocking(
91 struct cds_wfcq_head
*dest_q_head
,
92 struct cds_wfcq_tail
*dest_q_tail
,
93 struct cds_wfcq_head
*src_q_head
,
94 struct cds_wfcq_tail
*src_q_tail
)
96 return _cds_wfcq_splice_blocking(dest_q_head
, dest_q_tail
,
97 src_q_head
, src_q_tail
);
100 struct cds_wfcq_node
*__cds_wfcq_dequeue_blocking(
101 cds_wfcq_head_ptr_t head
,
102 struct cds_wfcq_tail
*tail
)
104 return ___cds_wfcq_dequeue_blocking(head
, tail
);
107 struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_blocking(
108 cds_wfcq_head_ptr_t head
,
109 struct cds_wfcq_tail
*tail
,
112 return ___cds_wfcq_dequeue_with_state_blocking(head
, tail
, state
);
115 struct cds_wfcq_node
*__cds_wfcq_dequeue_nonblocking(
116 cds_wfcq_head_ptr_t head
,
117 struct cds_wfcq_tail
*tail
)
119 return ___cds_wfcq_dequeue_nonblocking(head
, tail
);
122 struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_nonblocking(
123 cds_wfcq_head_ptr_t head
,
124 struct cds_wfcq_tail
*tail
,
127 return ___cds_wfcq_dequeue_with_state_nonblocking(head
, tail
, state
);
130 enum cds_wfcq_ret
__cds_wfcq_splice_blocking(
131 cds_wfcq_head_ptr_t dest_q_head
,
132 struct cds_wfcq_tail
*dest_q_tail
,
133 cds_wfcq_head_ptr_t src_q_head
,
134 struct cds_wfcq_tail
*src_q_tail
)
136 return ___cds_wfcq_splice_blocking(dest_q_head
, dest_q_tail
,
137 src_q_head
, src_q_tail
);
140 enum cds_wfcq_ret
__cds_wfcq_splice_nonblocking(
141 cds_wfcq_head_ptr_t dest_q_head
,
142 struct cds_wfcq_tail
*dest_q_tail
,
143 cds_wfcq_head_ptr_t src_q_head
,
144 struct cds_wfcq_tail
*src_q_tail
)
146 return ___cds_wfcq_splice_nonblocking(dest_q_head
, dest_q_tail
,
147 src_q_head
, src_q_tail
);
150 struct cds_wfcq_node
*__cds_wfcq_first_blocking(
151 cds_wfcq_head_ptr_t head
,
152 struct cds_wfcq_tail
*tail
)
154 return ___cds_wfcq_first_blocking(head
, tail
);
157 struct cds_wfcq_node
*__cds_wfcq_first_nonblocking(
158 cds_wfcq_head_ptr_t head
,
159 struct cds_wfcq_tail
*tail
)
161 return ___cds_wfcq_first_nonblocking(head
, tail
);
164 struct cds_wfcq_node
*__cds_wfcq_next_blocking(
165 cds_wfcq_head_ptr_t head
,
166 struct cds_wfcq_tail
*tail
,
167 struct cds_wfcq_node
*node
)
169 return ___cds_wfcq_next_blocking(head
, tail
, node
);
172 struct cds_wfcq_node
*__cds_wfcq_next_nonblocking(
173 cds_wfcq_head_ptr_t head
,
174 struct cds_wfcq_tail
*tail
,
175 struct cds_wfcq_node
*node
)
177 return ___cds_wfcq_next_nonblocking(head
, tail
, node
);