-
Notifications
You must be signed in to change notification settings - Fork 0
/
wfcqueue.c
178 lines (155 loc) · 4.64 KB
/
wfcqueue.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
* wfcqueue.c
*
* Userspace RCU library - Concurrent Queue with Wait-Free Enqueue/Blocking Dequeue
*
* Copyright 2010-2012 - Mathieu Desnoyers <[email protected]>
* Copyright 2011-2012 - Lai Jiangshan <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
#include "urcu/wfcqueue.h"
#include "urcu/static/wfcqueue.h"
/*
* library wrappers to be used by non-LGPL compatible source code.
*/
void cds_wfcq_node_init(struct cds_wfcq_node *node)
{
_cds_wfcq_node_init(node);
}
void cds_wfcq_init(struct cds_wfcq_head *head,
struct cds_wfcq_tail *tail)
{
_cds_wfcq_init(head, tail);
}
void __cds_wfcq_init(struct __cds_wfcq_head *head,
struct cds_wfcq_tail *tail)
{
___cds_wfcq_init(head, tail);
}
bool cds_wfcq_empty(cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail)
{
return _cds_wfcq_empty(head, tail);
}
bool cds_wfcq_enqueue(cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail,
struct cds_wfcq_node *node)
{
return _cds_wfcq_enqueue(head, tail, node);
}
void cds_wfcq_dequeue_lock(struct cds_wfcq_head *head,
struct cds_wfcq_tail *tail)
{
_cds_wfcq_dequeue_lock(head, tail);
}
void cds_wfcq_dequeue_unlock(struct cds_wfcq_head *head,
struct cds_wfcq_tail *tail)
{
_cds_wfcq_dequeue_unlock(head, tail);
}
struct cds_wfcq_node *cds_wfcq_dequeue_blocking(
struct cds_wfcq_head *head,
struct cds_wfcq_tail *tail)
{
return _cds_wfcq_dequeue_blocking(head, tail);
}
struct cds_wfcq_node *cds_wfcq_dequeue_with_state_blocking(
struct cds_wfcq_head *head,
struct cds_wfcq_tail *tail,
int *state)
{
return _cds_wfcq_dequeue_with_state_blocking(head, tail, state);
}
enum cds_wfcq_ret cds_wfcq_splice_blocking(
struct cds_wfcq_head *dest_q_head,
struct cds_wfcq_tail *dest_q_tail,
struct cds_wfcq_head *src_q_head,
struct cds_wfcq_tail *src_q_tail)
{
return _cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
src_q_head, src_q_tail);
}
struct cds_wfcq_node *__cds_wfcq_dequeue_blocking(
cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail)
{
return ___cds_wfcq_dequeue_blocking(head, tail);
}
struct cds_wfcq_node *__cds_wfcq_dequeue_with_state_blocking(
cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail,
int *state)
{
return ___cds_wfcq_dequeue_with_state_blocking(head, tail, state);
}
struct cds_wfcq_node *__cds_wfcq_dequeue_nonblocking(
cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail)
{
return ___cds_wfcq_dequeue_nonblocking(head, tail);
}
struct cds_wfcq_node *__cds_wfcq_dequeue_with_state_nonblocking(
cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail,
int *state)
{
return ___cds_wfcq_dequeue_with_state_nonblocking(head, tail, state);
}
enum cds_wfcq_ret __cds_wfcq_splice_blocking(
cds_wfcq_head_ptr_t dest_q_head,
struct cds_wfcq_tail *dest_q_tail,
cds_wfcq_head_ptr_t src_q_head,
struct cds_wfcq_tail *src_q_tail)
{
return ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
src_q_head, src_q_tail);
}
enum cds_wfcq_ret __cds_wfcq_splice_nonblocking(
cds_wfcq_head_ptr_t dest_q_head,
struct cds_wfcq_tail *dest_q_tail,
cds_wfcq_head_ptr_t src_q_head,
struct cds_wfcq_tail *src_q_tail)
{
return ___cds_wfcq_splice_nonblocking(dest_q_head, dest_q_tail,
src_q_head, src_q_tail);
}
struct cds_wfcq_node *__cds_wfcq_first_blocking(
cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail)
{
return ___cds_wfcq_first_blocking(head, tail);
}
struct cds_wfcq_node *__cds_wfcq_first_nonblocking(
cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail)
{
return ___cds_wfcq_first_nonblocking(head, tail);
}
struct cds_wfcq_node *__cds_wfcq_next_blocking(
cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail,
struct cds_wfcq_node *node)
{
return ___cds_wfcq_next_blocking(head, tail, node);
}
struct cds_wfcq_node *__cds_wfcq_next_nonblocking(
cds_wfcq_head_ptr_t head,
struct cds_wfcq_tail *tail,
struct cds_wfcq_node *node)
{
return ___cds_wfcq_next_nonblocking(head, tail, node);
}