1 #ifndef _URCU_WFCQUEUE_H
2 #define _URCU_WFCQUEUE_H
7 * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue
9 * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 * Copyright 2011-2012 - Lai Jiangshan <laijs@cn.fujitsu.com>
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 #include <urcu/compiler.h>
30 #include <urcu/arch.h>
37 * Concurrent queue with wait-free enqueue/blocking dequeue.
39 * This queue has been designed and implemented collaboratively by
40 * Mathieu Desnoyers and Lai Jiangshan. Inspired from
41 * half-wait-free/half-blocking queue implementation done by Paul E.
45 #define CDS_WFCQ_WOULDBLOCK ((struct cds_wfcq_node *) -1UL)
48 CDS_WFCQ_RET_WOULDBLOCK
= -1,
49 CDS_WFCQ_RET_DEST_EMPTY
= 0,
50 CDS_WFCQ_RET_DEST_NON_EMPTY
= 1,
51 CDS_WFCQ_RET_SRC_EMPTY
= 2,
55 CDS_WFCQ_STATE_LAST
= (1U << 0),
58 struct cds_wfcq_node
{
59 struct cds_wfcq_node
*next
;
63 * Do not put head and tail on the same cache-line if concurrent
64 * enqueue/dequeue are expected from many CPUs. This eliminates
65 * false-sharing between enqueue and dequeue.
67 struct __cds_wfcq_head
{
68 struct cds_wfcq_node node
;
71 struct cds_wfcq_head
{
72 struct cds_wfcq_node node
;
77 * In C, the transparent union allows calling functions that work on both
78 * struct cds_wfcq_head and struct __cds_wfcq_head on any of those two
81 * In C++, implement static inline wrappers using function overloading
82 * to obtain an API similar to C.
85 struct __cds_wfcq_head
*_h
;
86 struct cds_wfcq_head
*h
;
87 } caa_c_transparent_union cds_wfcq_head_ptr_t
;
91 * This static inline is only present for compatibility with C++. It is
94 static inline struct __cds_wfcq_head
*__cds_wfcq_head_cast(struct __cds_wfcq_head
*head
)
100 * This static inline is only present for compatibility with C++. It is
103 static inline struct cds_wfcq_head
*cds_wfcq_head_cast(struct cds_wfcq_head
*head
)
107 #else /* #ifndef __cplusplus */
110 * This static inline is used by C++ function overloading. It is also
111 * used internally in the static inline implementation of the API.
113 static inline cds_wfcq_head_ptr_t
__cds_wfcq_head_cast(struct __cds_wfcq_head
*head
)
115 cds_wfcq_head_ptr_t ret
= { ._h
= head
};
120 * This static inline is used by C++ function overloading. It is also
121 * used internally in the static inline implementation of the API.
123 static inline cds_wfcq_head_ptr_t
cds_wfcq_head_cast(struct cds_wfcq_head
*head
)
125 cds_wfcq_head_ptr_t ret
= { .h
= head
};
128 #endif /* #else #ifndef __cplusplus */
130 struct cds_wfcq_tail
{
131 struct cds_wfcq_node
*p
;
136 #include <urcu/static/wfcqueue.h>
138 #define cds_wfcq_node_init _cds_wfcq_node_init
139 #define cds_wfcq_init _cds_wfcq_init
140 #define __cds_wfcq_init ___cds_wfcq_init
141 #define cds_wfcq_destroy _cds_wfcq_destroy
142 #define cds_wfcq_empty _cds_wfcq_empty
143 #define cds_wfcq_enqueue _cds_wfcq_enqueue
145 /* Dequeue locking */
146 #define cds_wfcq_dequeue_lock _cds_wfcq_dequeue_lock
147 #define cds_wfcq_dequeue_unlock _cds_wfcq_dequeue_unlock
149 /* Locking performed within cds_wfcq calls. */
150 #define cds_wfcq_dequeue_blocking _cds_wfcq_dequeue_blocking
151 #define cds_wfcq_dequeue_with_state_blocking \
152 _cds_wfcq_dequeue_with_state_blocking
153 #define cds_wfcq_splice_blocking _cds_wfcq_splice_blocking
154 #define cds_wfcq_first_blocking _cds_wfcq_first_blocking
155 #define cds_wfcq_next_blocking _cds_wfcq_next_blocking
157 /* Locking ensured by caller by holding cds_wfcq_dequeue_lock() */
158 #define __cds_wfcq_dequeue_blocking ___cds_wfcq_dequeue_blocking
159 #define __cds_wfcq_dequeue_with_state_blocking \
160 ___cds_wfcq_dequeue_with_state_blocking
161 #define __cds_wfcq_splice_blocking ___cds_wfcq_splice_blocking
162 #define __cds_wfcq_first_blocking ___cds_wfcq_first_blocking
163 #define __cds_wfcq_next_blocking ___cds_wfcq_next_blocking
166 * Locking ensured by caller by holding cds_wfcq_dequeue_lock().
167 * Non-blocking: deque, first, next return CDS_WFCQ_WOULDBLOCK if they
168 * need to block. splice returns nonzero if it needs to block.
170 #define __cds_wfcq_dequeue_nonblocking ___cds_wfcq_dequeue_nonblocking
171 #define __cds_wfcq_dequeue_with_state_nonblocking \
172 ___cds_wfcq_dequeue_with_state_nonblocking
173 #define __cds_wfcq_splice_nonblocking ___cds_wfcq_splice_nonblocking
174 #define __cds_wfcq_first_nonblocking ___cds_wfcq_first_nonblocking
175 #define __cds_wfcq_next_nonblocking ___cds_wfcq_next_nonblocking
177 #else /* !_LGPL_SOURCE */
180 * Mutual exclusion of cds_wfcq_* / __cds_wfcq_* API
182 * Synchronization table:
184 * External synchronization techniques described in the API below is
185 * required between pairs marked with "X". No external synchronization
186 * required between pairs marked with "-".
189 * [1] cds_wfcq_enqueue
190 * [2] __cds_wfcq_splice (destination queue)
191 * [3] __cds_wfcq_dequeue
192 * [4] __cds_wfcq_splice (source queue)
193 * [5] __cds_wfcq_first
194 * [6] __cds_wfcq_next
196 * [1] [2] [3] [4] [5] [6]
204 * Mutual exclusion can be ensured by holding cds_wfcq_dequeue_lock().
206 * For convenience, cds_wfcq_dequeue_blocking() and
207 * cds_wfcq_splice_blocking() hold the dequeue lock.
209 * Besides locking, mutual exclusion of dequeue, splice and iteration
210 * can be ensured by performing all of those operations from a single
211 * thread, without requiring any lock.
215 * cds_wfcq_node_init: initialize wait-free queue node.
217 extern void cds_wfcq_node_init(struct cds_wfcq_node
*node
);
220 * cds_wfcq_init: initialize wait-free queue. Pair with
221 * cds_wfcq_destroy().
223 extern void cds_wfcq_init(struct cds_wfcq_head
*head
,
224 struct cds_wfcq_tail
*tail
);
227 * cds_wfcq_destroy: destroy wait-free queue. Pair with
230 extern void cds_wfcq_destroy(struct cds_wfcq_head
*head
,
231 struct cds_wfcq_tail
*tail
);
234 * __cds_wfcq_init: initialize wait-free queue (without lock). Don't
235 * pair with any destroy function.
237 extern void __cds_wfcq_init(struct __cds_wfcq_head
*head
,
238 struct cds_wfcq_tail
*tail
);
241 * cds_wfcq_empty: return whether wait-free queue is empty.
243 * No memory barrier is issued. No mutual exclusion is required.
245 extern bool cds_wfcq_empty(cds_wfcq_head_ptr_t head
,
246 struct cds_wfcq_tail
*tail
);
249 * cds_wfcq_dequeue_lock: take the dequeue mutual exclusion lock.
251 extern void cds_wfcq_dequeue_lock(struct cds_wfcq_head
*head
,
252 struct cds_wfcq_tail
*tail
);
255 * cds_wfcq_dequeue_unlock: release the dequeue mutual exclusion lock.
257 extern void cds_wfcq_dequeue_unlock(struct cds_wfcq_head
*head
,
258 struct cds_wfcq_tail
*tail
);
261 * cds_wfcq_enqueue: enqueue a node into a wait-free queue.
263 * Issues a full memory barrier before enqueue. No mutual exclusion is
266 * Returns false if the queue was empty prior to adding the node.
267 * Returns true otherwise.
269 extern bool cds_wfcq_enqueue(cds_wfcq_head_ptr_t head
,
270 struct cds_wfcq_tail
*tail
,
271 struct cds_wfcq_node
*node
);
274 * cds_wfcq_dequeue_blocking: dequeue a node from a wait-free queue.
276 * Content written into the node before enqueue is guaranteed to be
277 * consistent, but no other memory ordering is ensured.
278 * It is valid to reuse and free a dequeued node immediately.
279 * Mutual exclusion with cds_wfcq_dequeue_blocking and dequeue lock is
282 extern struct cds_wfcq_node
*cds_wfcq_dequeue_blocking(
283 struct cds_wfcq_head
*head
,
284 struct cds_wfcq_tail
*tail
);
287 * cds_wfcq_dequeue_with_state_blocking: dequeue with state.
289 * Same as cds_wfcq_dequeue_blocking, but saves whether dequeueing the
290 * last node of the queue into state (CDS_WFCQ_STATE_LAST).
292 extern struct cds_wfcq_node
*cds_wfcq_dequeue_with_state_blocking(
293 struct cds_wfcq_head
*head
,
294 struct cds_wfcq_tail
*tail
,
298 * cds_wfcq_splice_blocking: enqueue all src_q nodes at the end of dest_q.
300 * Dequeue all nodes from src_q.
301 * dest_q must be already initialized.
302 * Content written into the node before enqueue is guaranteed to be
303 * consistent, but no other memory ordering is ensured.
304 * Mutual exclusion with cds_wfcq_dequeue_blocking and dequeue lock is
307 * Returns enum cds_wfcq_ret which indicates the state of the src or
310 extern enum cds_wfcq_ret
cds_wfcq_splice_blocking(
311 struct cds_wfcq_head
*dest_q_head
,
312 struct cds_wfcq_tail
*dest_q_tail
,
313 struct cds_wfcq_head
*src_q_head
,
314 struct cds_wfcq_tail
*src_q_tail
);
317 * __cds_wfcq_dequeue_blocking: dequeue a node from a wait-free queue.
319 * Content written into the node before enqueue is guaranteed to be
320 * consistent, but no other memory ordering is ensured.
321 * It is valid to reuse and free a dequeued node immediately.
322 * Dequeue/splice/iteration mutual exclusion should be ensured by the
325 extern struct cds_wfcq_node
*__cds_wfcq_dequeue_blocking(
326 cds_wfcq_head_ptr_t head
,
327 struct cds_wfcq_tail
*tail
);
330 * __cds_wfcq_dequeue_with_state_blocking: dequeue with state.
332 * Same as __cds_wfcq_dequeue_blocking, but saves whether dequeueing the
333 * last node of the queue into state (CDS_WFCQ_STATE_LAST).
335 extern struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_blocking(
336 cds_wfcq_head_ptr_t head
,
337 struct cds_wfcq_tail
*tail
,
341 * __cds_wfcq_dequeue_nonblocking: dequeue a node from a wait-free queue.
343 * Same as __cds_wfcq_dequeue_blocking, but returns CDS_WFCQ_WOULDBLOCK
344 * if it needs to block.
346 extern struct cds_wfcq_node
*__cds_wfcq_dequeue_nonblocking(
347 cds_wfcq_head_ptr_t head
,
348 struct cds_wfcq_tail
*tail
);
351 * __cds_wfcq_dequeue_with_state_blocking: dequeue with state.
353 * Same as __cds_wfcq_dequeue_nonblocking, but saves whether dequeueing
354 * the last node of the queue into state (CDS_WFCQ_STATE_LAST).
356 extern struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_nonblocking(
357 cds_wfcq_head_ptr_t head
,
358 struct cds_wfcq_tail
*tail
,
362 * __cds_wfcq_splice_blocking: enqueue all src_q nodes at the end of dest_q.
364 * Dequeue all nodes from src_q.
365 * dest_q must be already initialized.
366 * Mutual exclusion for src_q should be ensured by the caller as
367 * specified in the "Synchronisation table".
368 * Returns enum cds_wfcq_ret which indicates the state of the src or
369 * dest queue. Never returns CDS_WFCQ_RET_WOULDBLOCK.
371 extern enum cds_wfcq_ret
__cds_wfcq_splice_blocking(
372 cds_wfcq_head_ptr_t dest_q_head
,
373 struct cds_wfcq_tail
*dest_q_tail
,
374 cds_wfcq_head_ptr_t src_q_head
,
375 struct cds_wfcq_tail
*src_q_tail
);
378 * __cds_wfcq_splice_nonblocking: enqueue all src_q nodes at the end of dest_q.
380 * Same as __cds_wfcq_splice_blocking, but returns
381 * CDS_WFCQ_RET_WOULDBLOCK if it needs to block.
383 extern enum cds_wfcq_ret
__cds_wfcq_splice_nonblocking(
384 cds_wfcq_head_ptr_t dest_q_head
,
385 struct cds_wfcq_tail
*dest_q_tail
,
386 cds_wfcq_head_ptr_t src_q_head
,
387 struct cds_wfcq_tail
*src_q_tail
);
390 * __cds_wfcq_first_blocking: get first node of a queue, without dequeuing.
392 * Content written into the node before enqueue is guaranteed to be
393 * consistent, but no other memory ordering is ensured.
394 * Dequeue/splice/iteration mutual exclusion should be ensured by the
397 * Used by for-like iteration macros:
398 * __cds_wfcq_for_each_blocking()
399 * __cds_wfcq_for_each_blocking_safe()
401 * Returns NULL if queue is empty, first node otherwise.
403 extern struct cds_wfcq_node
*__cds_wfcq_first_blocking(
404 cds_wfcq_head_ptr_t head
,
405 struct cds_wfcq_tail
*tail
);
408 * __cds_wfcq_first_nonblocking: get first node of a queue, without dequeuing.
410 * Same as __cds_wfcq_first_blocking, but returns CDS_WFCQ_WOULDBLOCK if
413 extern struct cds_wfcq_node
*__cds_wfcq_first_nonblocking(
414 cds_wfcq_head_ptr_t head
,
415 struct cds_wfcq_tail
*tail
);
418 * __cds_wfcq_next_blocking: get next node of a queue, without dequeuing.
420 * Content written into the node before enqueue is guaranteed to be
421 * consistent, but no other memory ordering is ensured.
422 * Dequeue/splice/iteration mutual exclusion should be ensured by the
425 * Used by for-like iteration macros:
426 * __cds_wfcq_for_each_blocking()
427 * __cds_wfcq_for_each_blocking_safe()
429 * Returns NULL if reached end of queue, non-NULL next queue node
432 extern struct cds_wfcq_node
*__cds_wfcq_next_blocking(
433 cds_wfcq_head_ptr_t head
,
434 struct cds_wfcq_tail
*tail
,
435 struct cds_wfcq_node
*node
);
438 * __cds_wfcq_next_blocking: get next node of a queue, without dequeuing.
440 * Same as __cds_wfcq_next_blocking, but returns CDS_WFCQ_WOULDBLOCK if
443 extern struct cds_wfcq_node
*__cds_wfcq_next_nonblocking(
444 cds_wfcq_head_ptr_t head
,
445 struct cds_wfcq_tail
*tail
,
446 struct cds_wfcq_node
*node
);
448 #endif /* !_LGPL_SOURCE */
451 * __cds_wfcq_for_each_blocking: Iterate over all nodes in a queue,
452 * without dequeuing them.
453 * @head: head of the queue (struct cds_wfcq_head or __cds_wfcq_head pointer).
454 * @tail: tail of the queue (struct cds_wfcq_tail pointer).
455 * @node: iterator on the queue (struct cds_wfcq_node pointer).
457 * Content written into each node before enqueue is guaranteed to be
458 * consistent, but no other memory ordering is ensured.
459 * Dequeue/splice/iteration mutual exclusion should be ensured by the
462 #define __cds_wfcq_for_each_blocking(head, tail, node) \
463 for (node = __cds_wfcq_first_blocking(head, tail); \
465 node = __cds_wfcq_next_blocking(head, tail, node))
468 * __cds_wfcq_for_each_blocking_safe: Iterate over all nodes in a queue,
469 * without dequeuing them. Safe against deletion.
470 * @head: head of the queue (struct cds_wfcq_head or __cds_wfcq_head pointer).
471 * @tail: tail of the queue (struct cds_wfcq_tail pointer).
472 * @node: iterator on the queue (struct cds_wfcq_node pointer).
473 * @n: struct cds_wfcq_node pointer holding the next pointer (used
476 * Content written into each node before enqueue is guaranteed to be
477 * consistent, but no other memory ordering is ensured.
478 * Dequeue/splice/iteration mutual exclusion should be ensured by the
481 #define __cds_wfcq_for_each_blocking_safe(head, tail, node, n) \
482 for (node = __cds_wfcq_first_blocking(head, tail), \
483 n = (node ? __cds_wfcq_next_blocking(head, tail, node) : NULL); \
485 node = n, n = (node ? __cds_wfcq_next_blocking(head, tail, node) : NULL))
491 * In C++, implement static inline wrappers using function overloading
492 * to obtain an API similar to C.
495 static inline bool cds_wfcq_empty(struct __cds_wfcq_head
*head
,
496 struct cds_wfcq_tail
*tail
)
498 return cds_wfcq_empty(__cds_wfcq_head_cast(head
), tail
);
501 static inline bool cds_wfcq_empty(struct cds_wfcq_head
*head
,
502 struct cds_wfcq_tail
*tail
)
504 return cds_wfcq_empty(cds_wfcq_head_cast(head
), tail
);
507 static inline bool cds_wfcq_enqueue(struct __cds_wfcq_head
*head
,
508 struct cds_wfcq_tail
*tail
,
509 struct cds_wfcq_node
*node
)
511 return cds_wfcq_enqueue(__cds_wfcq_head_cast(head
), tail
, node
);
514 static inline bool cds_wfcq_enqueue(struct cds_wfcq_head
*head
,
515 struct cds_wfcq_tail
*tail
,
516 struct cds_wfcq_node
*node
)
518 return cds_wfcq_enqueue(cds_wfcq_head_cast(head
), tail
, node
);
521 static inline struct cds_wfcq_node
*__cds_wfcq_dequeue_blocking(
522 struct __cds_wfcq_head
*head
,
523 struct cds_wfcq_tail
*tail
)
525 return __cds_wfcq_dequeue_blocking(__cds_wfcq_head_cast(head
), tail
);
528 static inline struct cds_wfcq_node
*__cds_wfcq_dequeue_blocking(
529 struct cds_wfcq_head
*head
,
530 struct cds_wfcq_tail
*tail
)
532 return __cds_wfcq_dequeue_blocking(cds_wfcq_head_cast(head
), tail
);
535 static inline struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_blocking(
536 struct __cds_wfcq_head
*head
,
537 struct cds_wfcq_tail
*tail
,
540 return __cds_wfcq_dequeue_with_state_blocking(__cds_wfcq_head_cast(head
),
544 static inline struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_blocking(
545 struct cds_wfcq_head
*head
,
546 struct cds_wfcq_tail
*tail
,
549 return __cds_wfcq_dequeue_with_state_blocking(cds_wfcq_head_cast(head
),
553 static inline struct cds_wfcq_node
*__cds_wfcq_dequeue_nonblocking(
554 struct __cds_wfcq_head
*head
,
555 struct cds_wfcq_tail
*tail
)
557 return __cds_wfcq_dequeue_nonblocking(__cds_wfcq_head_cast(head
), tail
);
560 static inline struct cds_wfcq_node
*__cds_wfcq_dequeue_nonblocking(
561 struct cds_wfcq_head
*head
,
562 struct cds_wfcq_tail
*tail
)
564 return __cds_wfcq_dequeue_nonblocking(cds_wfcq_head_cast(head
), tail
);
567 static inline struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_nonblocking(
568 struct __cds_wfcq_head
*head
,
569 struct cds_wfcq_tail
*tail
,
572 return __cds_wfcq_dequeue_with_state_nonblocking(__cds_wfcq_head_cast(head
),
576 static inline struct cds_wfcq_node
*__cds_wfcq_dequeue_with_state_nonblocking(
577 struct cds_wfcq_head
*head
,
578 struct cds_wfcq_tail
*tail
,
581 return __cds_wfcq_dequeue_with_state_nonblocking(cds_wfcq_head_cast(head
),
585 /* Support the power set of type combinations. */
586 static inline enum cds_wfcq_ret
__cds_wfcq_splice_blocking(
587 struct __cds_wfcq_head
*dest_q_head
,
588 struct cds_wfcq_tail
*dest_q_tail
,
589 struct __cds_wfcq_head
*src_q_head
,
590 struct cds_wfcq_tail
*src_q_tail
)
592 return __cds_wfcq_splice_blocking(__cds_wfcq_head_cast(dest_q_head
),
594 __cds_wfcq_head_cast(src_q_head
),
598 static inline enum cds_wfcq_ret
__cds_wfcq_splice_blocking(
599 struct cds_wfcq_head
*dest_q_head
,
600 struct cds_wfcq_tail
*dest_q_tail
,
601 struct __cds_wfcq_head
*src_q_head
,
602 struct cds_wfcq_tail
*src_q_tail
)
604 return __cds_wfcq_splice_blocking(cds_wfcq_head_cast(dest_q_head
),
606 __cds_wfcq_head_cast(src_q_head
),
610 static inline enum cds_wfcq_ret
__cds_wfcq_splice_blocking(
611 struct __cds_wfcq_head
*dest_q_head
,
612 struct cds_wfcq_tail
*dest_q_tail
,
613 struct cds_wfcq_head
*src_q_head
,
614 struct cds_wfcq_tail
*src_q_tail
)
616 return __cds_wfcq_splice_blocking(__cds_wfcq_head_cast(dest_q_head
),
618 cds_wfcq_head_cast(src_q_head
),
622 static inline enum cds_wfcq_ret
__cds_wfcq_splice_blocking(
623 struct cds_wfcq_head
*dest_q_head
,
624 struct cds_wfcq_tail
*dest_q_tail
,
625 struct cds_wfcq_head
*src_q_head
,
626 struct cds_wfcq_tail
*src_q_tail
)
628 return __cds_wfcq_splice_blocking(cds_wfcq_head_cast(dest_q_head
),
630 cds_wfcq_head_cast(src_q_head
),
634 /* Support the power set of type combinations. */
635 static inline enum cds_wfcq_ret
__cds_wfcq_splice_nonblocking(
636 struct __cds_wfcq_head
*dest_q_head
,
637 struct cds_wfcq_tail
*dest_q_tail
,
638 struct __cds_wfcq_head
*src_q_head
,
639 struct cds_wfcq_tail
*src_q_tail
)
641 return __cds_wfcq_splice_nonblocking(__cds_wfcq_head_cast(dest_q_head
),
643 __cds_wfcq_head_cast(src_q_head
),
647 static inline enum cds_wfcq_ret
__cds_wfcq_splice_nonblocking(
648 struct cds_wfcq_head
*dest_q_head
,
649 struct cds_wfcq_tail
*dest_q_tail
,
650 struct __cds_wfcq_head
*src_q_head
,
651 struct cds_wfcq_tail
*src_q_tail
)
653 return __cds_wfcq_splice_nonblocking(cds_wfcq_head_cast(dest_q_head
),
655 __cds_wfcq_head_cast(src_q_head
),
659 static inline enum cds_wfcq_ret
__cds_wfcq_splice_nonblocking(
660 struct __cds_wfcq_head
*dest_q_head
,
661 struct cds_wfcq_tail
*dest_q_tail
,
662 struct cds_wfcq_head
*src_q_head
,
663 struct cds_wfcq_tail
*src_q_tail
)
665 return __cds_wfcq_splice_nonblocking(__cds_wfcq_head_cast(dest_q_head
),
667 cds_wfcq_head_cast(src_q_head
),
671 static inline enum cds_wfcq_ret
__cds_wfcq_splice_nonblocking(
672 struct cds_wfcq_head
*dest_q_head
,
673 struct cds_wfcq_tail
*dest_q_tail
,
674 struct cds_wfcq_head
*src_q_head
,
675 struct cds_wfcq_tail
*src_q_tail
)
677 return __cds_wfcq_splice_nonblocking(cds_wfcq_head_cast(dest_q_head
),
679 cds_wfcq_head_cast(src_q_head
),
683 static inline struct cds_wfcq_node
*__cds_wfcq_first_blocking(
684 struct __cds_wfcq_head
*head
,
685 struct cds_wfcq_tail
*tail
)
687 return __cds_wfcq_first_blocking(__cds_wfcq_head_cast(head
), tail
);
690 static inline struct cds_wfcq_node
*__cds_wfcq_first_blocking(
691 struct cds_wfcq_head
*head
,
692 struct cds_wfcq_tail
*tail
)
694 return __cds_wfcq_first_blocking(cds_wfcq_head_cast(head
), tail
);
697 static inline struct cds_wfcq_node
*__cds_wfcq_first_nonblocking(
698 struct __cds_wfcq_head
*head
,
699 struct cds_wfcq_tail
*tail
)
701 return __cds_wfcq_first_nonblocking(__cds_wfcq_head_cast(head
), tail
);
704 static inline struct cds_wfcq_node
*__cds_wfcq_first_nonblocking(
705 struct cds_wfcq_head
*head
,
706 struct cds_wfcq_tail
*tail
)
708 return __cds_wfcq_first_nonblocking(cds_wfcq_head_cast(head
), tail
);
711 static inline struct cds_wfcq_node
*__cds_wfcq_next_blocking(
712 struct __cds_wfcq_head
*head
,
713 struct cds_wfcq_tail
*tail
,
714 struct cds_wfcq_node
*node
)
716 return __cds_wfcq_next_blocking(__cds_wfcq_head_cast(head
), tail
, node
);
719 static inline struct cds_wfcq_node
*__cds_wfcq_next_blocking(
720 struct cds_wfcq_head
*head
,
721 struct cds_wfcq_tail
*tail
,
722 struct cds_wfcq_node
*node
)
724 return __cds_wfcq_next_blocking(cds_wfcq_head_cast(head
), tail
, node
);
727 static inline struct cds_wfcq_node
*__cds_wfcq_next_nonblocking(
728 struct __cds_wfcq_head
*head
,
729 struct cds_wfcq_tail
*tail
,
730 struct cds_wfcq_node
*node
)
732 return __cds_wfcq_next_nonblocking(__cds_wfcq_head_cast(head
), tail
, node
);
735 static inline struct cds_wfcq_node
*__cds_wfcq_next_nonblocking(
736 struct cds_wfcq_head
*head
,
737 struct cds_wfcq_tail
*tail
,
738 struct cds_wfcq_node
*node
)
740 return __cds_wfcq_next_nonblocking(cds_wfcq_head_cast(head
), tail
, node
);
745 #endif /* _URCU_WFCQUEUE_H */