Fix: handle reference count overflow
[urcu.git] / wfcqueue.c
CommitLineData
8ad4ce58
MD
1/*
2 * wfcqueue.c
3 *
f878b49e 4 * Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue
8ad4ce58
MD
5 *
6 * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * Copyright 2011-2012 - Lai Jiangshan <laijs@cn.fujitsu.com>
8 *
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.
13 *
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.
18 *
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
22 */
23
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"
27
28/*
29 * library wrappers to be used by non-LGPL compatible source code.
30 */
31
32void cds_wfcq_node_init(struct cds_wfcq_node *node)
33{
34 _cds_wfcq_node_init(node);
35}
36
37void cds_wfcq_init(struct cds_wfcq_head *head,
38 struct cds_wfcq_tail *tail)
39{
40 _cds_wfcq_init(head, tail);
41}
42
f637f191
MD
43void __cds_wfcq_init(struct __cds_wfcq_head *head,
44 struct cds_wfcq_tail *tail)
45{
46 ___cds_wfcq_init(head, tail);
47}
48
49bool cds_wfcq_empty(cds_wfcq_head_ptr_t head,
8ad4ce58
MD
50 struct cds_wfcq_tail *tail)
51
52{
53 return _cds_wfcq_empty(head, tail);
54}
55
f637f191 56bool cds_wfcq_enqueue(cds_wfcq_head_ptr_t head,
8ad4ce58
MD
57 struct cds_wfcq_tail *tail,
58 struct cds_wfcq_node *node)
59{
23773356 60 return _cds_wfcq_enqueue(head, tail, node);
8ad4ce58
MD
61}
62
63void cds_wfcq_dequeue_lock(struct cds_wfcq_head *head,
64 struct cds_wfcq_tail *tail)
65{
852a17ad 66 _cds_wfcq_dequeue_lock(head, tail);
8ad4ce58
MD
67}
68
69void cds_wfcq_dequeue_unlock(struct cds_wfcq_head *head,
70 struct cds_wfcq_tail *tail)
71{
852a17ad 72 _cds_wfcq_dequeue_unlock(head, tail);
8ad4ce58
MD
73}
74
75struct cds_wfcq_node *cds_wfcq_dequeue_blocking(
76 struct cds_wfcq_head *head,
77 struct cds_wfcq_tail *tail)
78{
79 return _cds_wfcq_dequeue_blocking(head, tail);
80}
81
eec791af
MD
82struct cds_wfcq_node *cds_wfcq_dequeue_with_state_blocking(
83 struct cds_wfcq_head *head,
84 struct cds_wfcq_tail *tail,
85 int *state)
86{
87 return _cds_wfcq_dequeue_with_state_blocking(head, tail, state);
88}
89
23773356 90enum cds_wfcq_ret cds_wfcq_splice_blocking(
8ad4ce58
MD
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)
95{
23773356 96 return _cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
8ad4ce58
MD
97 src_q_head, src_q_tail);
98}
99
100struct cds_wfcq_node *__cds_wfcq_dequeue_blocking(
f637f191 101 cds_wfcq_head_ptr_t head,
8ad4ce58
MD
102 struct cds_wfcq_tail *tail)
103{
104 return ___cds_wfcq_dequeue_blocking(head, tail);
105}
106
eec791af 107struct cds_wfcq_node *__cds_wfcq_dequeue_with_state_blocking(
f637f191 108 cds_wfcq_head_ptr_t head,
eec791af
MD
109 struct cds_wfcq_tail *tail,
110 int *state)
111{
112 return ___cds_wfcq_dequeue_with_state_blocking(head, tail, state);
113}
114
47215721 115struct cds_wfcq_node *__cds_wfcq_dequeue_nonblocking(
f637f191 116 cds_wfcq_head_ptr_t head,
47215721
MD
117 struct cds_wfcq_tail *tail)
118{
119 return ___cds_wfcq_dequeue_nonblocking(head, tail);
120}
121
eec791af 122struct cds_wfcq_node *__cds_wfcq_dequeue_with_state_nonblocking(
f637f191 123 cds_wfcq_head_ptr_t head,
eec791af
MD
124 struct cds_wfcq_tail *tail,
125 int *state)
126{
127 return ___cds_wfcq_dequeue_with_state_nonblocking(head, tail, state);
128}
129
23773356 130enum cds_wfcq_ret __cds_wfcq_splice_blocking(
f637f191 131 cds_wfcq_head_ptr_t dest_q_head,
8ad4ce58 132 struct cds_wfcq_tail *dest_q_tail,
f637f191 133 cds_wfcq_head_ptr_t src_q_head,
8ad4ce58
MD
134 struct cds_wfcq_tail *src_q_tail)
135{
23773356 136 return ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
8ad4ce58
MD
137 src_q_head, src_q_tail);
138}
139
23773356 140enum cds_wfcq_ret __cds_wfcq_splice_nonblocking(
f637f191 141 cds_wfcq_head_ptr_t dest_q_head,
47215721 142 struct cds_wfcq_tail *dest_q_tail,
f637f191 143 cds_wfcq_head_ptr_t src_q_head,
47215721
MD
144 struct cds_wfcq_tail *src_q_tail)
145{
146 return ___cds_wfcq_splice_nonblocking(dest_q_head, dest_q_tail,
147 src_q_head, src_q_tail);
148}
149
8ad4ce58 150struct cds_wfcq_node *__cds_wfcq_first_blocking(
f637f191 151 cds_wfcq_head_ptr_t head,
8ad4ce58
MD
152 struct cds_wfcq_tail *tail)
153{
154 return ___cds_wfcq_first_blocking(head, tail);
155}
156
47215721 157struct cds_wfcq_node *__cds_wfcq_first_nonblocking(
f637f191 158 cds_wfcq_head_ptr_t head,
47215721
MD
159 struct cds_wfcq_tail *tail)
160{
161 return ___cds_wfcq_first_nonblocking(head, tail);
162}
163
8ad4ce58 164struct cds_wfcq_node *__cds_wfcq_next_blocking(
f637f191 165 cds_wfcq_head_ptr_t head,
8ad4ce58
MD
166 struct cds_wfcq_tail *tail,
167 struct cds_wfcq_node *node)
168{
169 return ___cds_wfcq_next_blocking(head, tail, node);
170}
47215721
MD
171
172struct cds_wfcq_node *__cds_wfcq_next_nonblocking(
f637f191 173 cds_wfcq_head_ptr_t head,
47215721
MD
174 struct cds_wfcq_tail *tail,
175 struct cds_wfcq_node *node)
176{
177 return ___cds_wfcq_next_nonblocking(head, tail, node);
178}
This page took 0.035974 seconds and 4 git commands to generate.