Fix: tests: invoke destroy APIs for queues/stacks
[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
200d100e
MD
43void cds_wfcq_destroy(struct cds_wfcq_head *head,
44 struct cds_wfcq_tail *tail)
45{
46 _cds_wfcq_destroy(head, tail);
47}
48
f637f191
MD
49void __cds_wfcq_init(struct __cds_wfcq_head *head,
50 struct cds_wfcq_tail *tail)
51{
52 ___cds_wfcq_init(head, tail);
53}
54
55bool cds_wfcq_empty(cds_wfcq_head_ptr_t head,
8ad4ce58
MD
56 struct cds_wfcq_tail *tail)
57
58{
59 return _cds_wfcq_empty(head, tail);
60}
61
f637f191 62bool cds_wfcq_enqueue(cds_wfcq_head_ptr_t head,
8ad4ce58
MD
63 struct cds_wfcq_tail *tail,
64 struct cds_wfcq_node *node)
65{
23773356 66 return _cds_wfcq_enqueue(head, tail, node);
8ad4ce58
MD
67}
68
69void cds_wfcq_dequeue_lock(struct cds_wfcq_head *head,
70 struct cds_wfcq_tail *tail)
71{
852a17ad 72 _cds_wfcq_dequeue_lock(head, tail);
8ad4ce58
MD
73}
74
75void cds_wfcq_dequeue_unlock(struct cds_wfcq_head *head,
76 struct cds_wfcq_tail *tail)
77{
852a17ad 78 _cds_wfcq_dequeue_unlock(head, tail);
8ad4ce58
MD
79}
80
81struct cds_wfcq_node *cds_wfcq_dequeue_blocking(
82 struct cds_wfcq_head *head,
83 struct cds_wfcq_tail *tail)
84{
85 return _cds_wfcq_dequeue_blocking(head, tail);
86}
87
eec791af
MD
88struct cds_wfcq_node *cds_wfcq_dequeue_with_state_blocking(
89 struct cds_wfcq_head *head,
90 struct cds_wfcq_tail *tail,
91 int *state)
92{
93 return _cds_wfcq_dequeue_with_state_blocking(head, tail, state);
94}
95
23773356 96enum cds_wfcq_ret cds_wfcq_splice_blocking(
8ad4ce58
MD
97 struct cds_wfcq_head *dest_q_head,
98 struct cds_wfcq_tail *dest_q_tail,
99 struct cds_wfcq_head *src_q_head,
100 struct cds_wfcq_tail *src_q_tail)
101{
23773356 102 return _cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
8ad4ce58
MD
103 src_q_head, src_q_tail);
104}
105
106struct cds_wfcq_node *__cds_wfcq_dequeue_blocking(
f637f191 107 cds_wfcq_head_ptr_t head,
8ad4ce58
MD
108 struct cds_wfcq_tail *tail)
109{
110 return ___cds_wfcq_dequeue_blocking(head, tail);
111}
112
eec791af 113struct cds_wfcq_node *__cds_wfcq_dequeue_with_state_blocking(
f637f191 114 cds_wfcq_head_ptr_t head,
eec791af
MD
115 struct cds_wfcq_tail *tail,
116 int *state)
117{
118 return ___cds_wfcq_dequeue_with_state_blocking(head, tail, state);
119}
120
47215721 121struct cds_wfcq_node *__cds_wfcq_dequeue_nonblocking(
f637f191 122 cds_wfcq_head_ptr_t head,
47215721
MD
123 struct cds_wfcq_tail *tail)
124{
125 return ___cds_wfcq_dequeue_nonblocking(head, tail);
126}
127
eec791af 128struct cds_wfcq_node *__cds_wfcq_dequeue_with_state_nonblocking(
f637f191 129 cds_wfcq_head_ptr_t head,
eec791af
MD
130 struct cds_wfcq_tail *tail,
131 int *state)
132{
133 return ___cds_wfcq_dequeue_with_state_nonblocking(head, tail, state);
134}
135
23773356 136enum cds_wfcq_ret __cds_wfcq_splice_blocking(
f637f191 137 cds_wfcq_head_ptr_t dest_q_head,
8ad4ce58 138 struct cds_wfcq_tail *dest_q_tail,
f637f191 139 cds_wfcq_head_ptr_t src_q_head,
8ad4ce58
MD
140 struct cds_wfcq_tail *src_q_tail)
141{
23773356 142 return ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
8ad4ce58
MD
143 src_q_head, src_q_tail);
144}
145
23773356 146enum cds_wfcq_ret __cds_wfcq_splice_nonblocking(
f637f191 147 cds_wfcq_head_ptr_t dest_q_head,
47215721 148 struct cds_wfcq_tail *dest_q_tail,
f637f191 149 cds_wfcq_head_ptr_t src_q_head,
47215721
MD
150 struct cds_wfcq_tail *src_q_tail)
151{
152 return ___cds_wfcq_splice_nonblocking(dest_q_head, dest_q_tail,
153 src_q_head, src_q_tail);
154}
155
8ad4ce58 156struct cds_wfcq_node *__cds_wfcq_first_blocking(
f637f191 157 cds_wfcq_head_ptr_t head,
8ad4ce58
MD
158 struct cds_wfcq_tail *tail)
159{
160 return ___cds_wfcq_first_blocking(head, tail);
161}
162
47215721 163struct cds_wfcq_node *__cds_wfcq_first_nonblocking(
f637f191 164 cds_wfcq_head_ptr_t head,
47215721
MD
165 struct cds_wfcq_tail *tail)
166{
167 return ___cds_wfcq_first_nonblocking(head, tail);
168}
169
8ad4ce58 170struct cds_wfcq_node *__cds_wfcq_next_blocking(
f637f191 171 cds_wfcq_head_ptr_t head,
8ad4ce58
MD
172 struct cds_wfcq_tail *tail,
173 struct cds_wfcq_node *node)
174{
175 return ___cds_wfcq_next_blocking(head, tail, node);
176}
47215721
MD
177
178struct cds_wfcq_node *__cds_wfcq_next_nonblocking(
f637f191 179 cds_wfcq_head_ptr_t head,
47215721
MD
180 struct cds_wfcq_tail *tail,
181 struct cds_wfcq_node *node)
182{
183 return ___cds_wfcq_next_nonblocking(head, tail, node);
184}
This page took 0.051917 seconds and 4 git commands to generate.