1 // SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 // SPDX-FileCopyrightText: 2011-2012 Lai Jiangshan <laijs@cn.fujitsu.com>
4 // SPDX-License-Identifier: LGPL-2.1-or-later
7 * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue
10 /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
11 #include "urcu/wfcqueue.h"
12 #include "urcu/static/wfcqueue.h"
15 * library wrappers to be used by non-LGPL compatible source code.
18 void cds_wfcq_node_init(struct cds_wfcq_node
*node
)
20 _cds_wfcq_node_init(node
);
23 void cds_wfcq_init(struct cds_wfcq_head
*head
,
24 struct cds_wfcq_tail
*tail
)
26 _cds_wfcq_init(head
, tail
);
29 void cds_wfcq_destroy(struct cds_wfcq_head
*head
,
30 struct cds_wfcq_tail
*tail
)
32 _cds_wfcq_destroy(head
, tail
);
35 void __cds_wfcq_init(struct __cds_wfcq_head
*head
,
36 struct cds_wfcq_tail
*tail
)
38 ___cds_wfcq_init(head
, tail
);
41 bool cds_wfcq_empty(cds_wfcq_head_const_ptr_t head
,
42 const struct cds_wfcq_tail
*tail
)
45 return _cds_wfcq_empty(head
, tail
);
48 bool cds_wfcq_enqueue(cds_wfcq_head_ptr_t head
,
49 struct cds_wfcq_tail
*tail
,
50 struct cds_wfcq_node
*node
)
52 return _cds_wfcq_enqueue(head
, tail
, node
);
55 void cds_wfcq_dequeue_lock(struct cds_wfcq_head
*head
,
56 struct cds_wfcq_tail
*tail
)
58 _cds_wfcq_dequeue_lock(head
, tail
);
61 void cds_wfcq_dequeue_unlock(struct cds_wfcq_head
*head
,
62 struct cds_wfcq_tail
*tail
)
64 _cds_wfcq_dequeue_unlock(head
, tail
);
67 struct cds_wfcq_node
*cds_wfcq_dequeue_blocking(
68 struct cds_wfcq_head
*head
,
69 struct cds_wfcq_tail
*tail
)
71 return _cds_wfcq_dequeue_blocking(head
, tail
);
74 struct cds_wfcq_node
*cds_wfcq_dequeue_with_state_blocking(
75 struct cds_wfcq_head
*head
,
76 struct cds_wfcq_tail
*tail
,
79 return _cds_wfcq_dequeue_with_state_blocking(head
, tail
, state
);
82 enum cds_wfcq_ret
cds_wfcq_splice_blocking(
83 struct cds_wfcq_head
*dest_q_head
,
84 struct cds_wfcq_tail
*dest_q_tail
,
85 struct cds_wfcq_head
*src_q_head
,
86 struct cds_wfcq_tail
*src_q_tail
)
88 return _cds_wfcq_splice_blocking(dest_q_head
, dest_q_tail
,
89 src_q_head
, src_q_tail
);
92 struct cds_wfcq_node
*__cds_wfcq_dequeue_blocking(
93 cds_wfcq_head_ptr_t head
,
94 struct cds_wfcq_tail
*tail
)
96 return ___cds_wfcq_dequeue_blocking(head
, tail
);
99 struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_blocking(
100 cds_wfcq_head_ptr_t head
,
101 struct cds_wfcq_tail
*tail
,
104 return ___cds_wfcq_dequeue_with_state_blocking(head
, tail
, state
);
107 struct cds_wfcq_node
*__cds_wfcq_dequeue_nonblocking(
108 cds_wfcq_head_ptr_t head
,
109 struct cds_wfcq_tail
*tail
)
111 return ___cds_wfcq_dequeue_nonblocking(head
, tail
);
114 struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_nonblocking(
115 cds_wfcq_head_ptr_t head
,
116 struct cds_wfcq_tail
*tail
,
119 return ___cds_wfcq_dequeue_with_state_nonblocking(head
, tail
, state
);
122 enum cds_wfcq_ret
__cds_wfcq_splice_blocking(
123 cds_wfcq_head_ptr_t dest_q_head
,
124 struct cds_wfcq_tail
*dest_q_tail
,
125 cds_wfcq_head_ptr_t src_q_head
,
126 struct cds_wfcq_tail
*src_q_tail
)
128 return ___cds_wfcq_splice_blocking(dest_q_head
, dest_q_tail
,
129 src_q_head
, src_q_tail
);
132 enum cds_wfcq_ret
__cds_wfcq_splice_nonblocking(
133 cds_wfcq_head_ptr_t dest_q_head
,
134 struct cds_wfcq_tail
*dest_q_tail
,
135 cds_wfcq_head_ptr_t src_q_head
,
136 struct cds_wfcq_tail
*src_q_tail
)
138 return ___cds_wfcq_splice_nonblocking(dest_q_head
, dest_q_tail
,
139 src_q_head
, src_q_tail
);
142 struct cds_wfcq_node
*__cds_wfcq_first_blocking(
143 cds_wfcq_head_ptr_t head
,
144 struct cds_wfcq_tail
*tail
)
146 return ___cds_wfcq_first_blocking(head
, tail
);
149 struct cds_wfcq_node
*__cds_wfcq_first_nonblocking(
150 cds_wfcq_head_ptr_t head
,
151 struct cds_wfcq_tail
*tail
)
153 return ___cds_wfcq_first_nonblocking(head
, tail
);
156 struct cds_wfcq_node
*__cds_wfcq_next_blocking(
157 cds_wfcq_head_ptr_t head
,
158 struct cds_wfcq_tail
*tail
,
159 struct cds_wfcq_node
*node
)
161 return ___cds_wfcq_next_blocking(head
, tail
, node
);
164 struct cds_wfcq_node
*__cds_wfcq_next_nonblocking(
165 cds_wfcq_head_ptr_t head
,
166 struct cds_wfcq_tail
*tail
,
167 struct cds_wfcq_node
*node
)
169 return ___cds_wfcq_next_nonblocking(head
, tail
, node
);