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