Fix: uatomic arm32: add missing release barrier before uatomic_xchg
[urcu.git] / include / urcu / rculfstack.h
CommitLineData
c3f74cb2
MD
1#ifndef _URCU_RCULFSTACK_H
2#define _URCU_RCULFSTACK_H
3
453629a9
MD
4/*
5 * rculfstack.h
6 *
7 * Userspace RCU library - Lock-Free RCU Stack
8 *
9 * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
706d1165
MD
26#include <urcu/compiler.h>
27
0e2e9380
MD
28#ifdef __cplusplus
29extern "C" {
30#endif
31
d89ec762
MD
32#ifndef CDS_LFS_RCU_DEPRECATED
33#define CDS_LFS_RCU_DEPRECATED \
706d1165 34 CDS_DEPRECATED("urcu/rculfstack.h is deprecated. Please use urcu/lfstack.h instead.")
d89ec762
MD
35#endif
36
16aa9ee8
DG
37struct cds_lfs_node_rcu {
38 struct cds_lfs_node_rcu *next;
453629a9
MD
39};
40
16aa9ee8
DG
41struct cds_lfs_stack_rcu {
42 struct cds_lfs_node_rcu *head;
453629a9
MD
43};
44
b6a37eac 45#ifdef _LGPL_SOURCE
453629a9 46
af7c2dbe 47#include <urcu/static/rculfstack.h>
453629a9 48
d89ec762
MD
49static inline CDS_LFS_RCU_DEPRECATED
50void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node)
51{
52 _cds_lfs_node_init_rcu(node);
53}
54
55static inline
56void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s)
57{
58 _cds_lfs_init_rcu(s);
59}
60
61static inline CDS_LFS_RCU_DEPRECATED
62int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
63 struct cds_lfs_node_rcu *node)
64{
65 return _cds_lfs_push_rcu(s, node);
66}
67
68static inline CDS_LFS_RCU_DEPRECATED
69struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s)
70{
71 return _cds_lfs_pop_rcu(s);
72}
453629a9 73
b6a37eac
MD
74#else /* !_LGPL_SOURCE */
75
d89ec762
MD
76extern CDS_LFS_RCU_DEPRECATED
77void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node);
78extern CDS_LFS_RCU_DEPRECATED
79void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s);
80extern CDS_LFS_RCU_DEPRECATED
81int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
e1a3b81e 82 struct cds_lfs_node_rcu *node);
453629a9 83
1c1e940e 84/*
6e5f88cf 85 * Should be called under rcu read lock critical section.
d9b52143 86 *
1c1e940e 87 * The caller must wait for a grace period to pass before freeing the returned
16aa9ee8 88 * node or modifying the cds_lfs_node_rcu structure.
1c1e940e
MD
89 * Returns NULL if stack is empty.
90 */
d89ec762
MD
91extern CDS_LFS_RCU_DEPRECATED
92struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s);
453629a9 93
b6a37eac 94#endif /* !_LGPL_SOURCE */
c3f74cb2 95
0e2e9380
MD
96#ifdef __cplusplus
97}
98#endif
99
c3f74cb2 100#endif /* _URCU_RCULFSTACK_H */
This page took 0.054274 seconds and 4 git commands to generate.