1 // SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 // SPDX-License-Identifier: LGPL-2.1-or-later
5 #ifndef _URCU_WFQUEUE_H
6 #define _URCU_WFQUEUE_H
9 * Userspace RCU library - Queue with Wait-Free Enqueue/Blocking Dequeue
13 #include <urcu/compiler.h>
19 #ifndef CDS_WFQ_DEPRECATED
20 #define CDS_WFQ_DEPRECATED \
21 CDS_DEPRECATED("urcu/wfqueue.h is deprecated. Please use urcu/wfcqueue.h instead.")
25 * Queue with wait-free enqueue/blocking dequeue.
26 * This implementation adds a dummy head node when the queue is empty to ensure
27 * we can always update the queue locklessly.
29 * Inspired from half-wait-free/half-blocking queue implementation done by
34 struct cds_wfq_node
*next
;
37 struct cds_wfq_queue
{
38 struct cds_wfq_node
*head
, **tail
;
39 struct cds_wfq_node dummy
; /* Dummy node */
45 #include <urcu/static/wfqueue.h>
47 static inline CDS_WFQ_DEPRECATED
48 void cds_wfq_node_init(struct cds_wfq_node
*node
)
50 _cds_wfq_node_init(node
);
53 static inline CDS_WFQ_DEPRECATED
54 void cds_wfq_init(struct cds_wfq_queue
*q
)
59 static inline CDS_WFQ_DEPRECATED
60 void cds_wfq_destroy(struct cds_wfq_queue
*q
)
65 static inline CDS_WFQ_DEPRECATED
66 void cds_wfq_enqueue(struct cds_wfq_queue
*q
, struct cds_wfq_node
*node
)
68 _cds_wfq_enqueue(q
, node
);
71 static inline CDS_WFQ_DEPRECATED
72 struct cds_wfq_node
*__cds_wfq_dequeue_blocking(struct cds_wfq_queue
*q
)
74 return ___cds_wfq_dequeue_blocking(q
);
77 static inline CDS_WFQ_DEPRECATED
78 struct cds_wfq_node
*cds_wfq_dequeue_blocking(struct cds_wfq_queue
*q
)
80 return _cds_wfq_dequeue_blocking(q
);
83 #else /* !_LGPL_SOURCE */
85 extern CDS_WFQ_DEPRECATED
86 void cds_wfq_node_init(struct cds_wfq_node
*node
);
88 extern CDS_WFQ_DEPRECATED
89 void cds_wfq_init(struct cds_wfq_queue
*q
);
91 extern CDS_WFQ_DEPRECATED
92 void cds_wfq_destroy(struct cds_wfq_queue
*q
);
94 extern CDS_WFQ_DEPRECATED
95 void cds_wfq_enqueue(struct cds_wfq_queue
*q
, struct cds_wfq_node
*node
);
97 /* __cds_wfq_dequeue_blocking: caller ensures mutual exclusion between dequeues */
98 extern CDS_WFQ_DEPRECATED
99 struct cds_wfq_node
*__cds_wfq_dequeue_blocking(struct cds_wfq_queue
*q
);
101 extern CDS_WFQ_DEPRECATED
102 struct cds_wfq_node
*cds_wfq_dequeue_blocking(struct cds_wfq_queue
*q
);
104 #endif /* !_LGPL_SOURCE */
110 #endif /* _URCU_WFQUEUE_H */
This page took 0.031649 seconds and 4 git commands to generate.