Deprecate wfqueue
[urcu.git] / urcu / rculfstack.h
... / ...
CommitLineData
1#ifndef _URCU_RCULFSTACK_H
2#define _URCU_RCULFSTACK_H
3
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
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#ifndef CDS_LFS_RCU_DEPRECATED
31#define CDS_LFS_RCU_DEPRECATED \
32 __attribute__((deprecated("urcu/rculfstack.h is deprecated. Please use urcu/lfstack.h instead.")))
33#endif
34
35struct cds_lfs_node_rcu {
36 struct cds_lfs_node_rcu *next;
37};
38
39struct cds_lfs_stack_rcu {
40 struct cds_lfs_node_rcu *head;
41};
42
43#ifdef _LGPL_SOURCE
44
45#include <urcu/static/rculfstack.h>
46
47static inline CDS_LFS_RCU_DEPRECATED
48void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node)
49{
50 _cds_lfs_node_init_rcu(node);
51}
52
53static inline
54void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s)
55{
56 _cds_lfs_init_rcu(s);
57}
58
59static inline CDS_LFS_RCU_DEPRECATED
60int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
61 struct cds_lfs_node_rcu *node)
62{
63 return _cds_lfs_push_rcu(s, node);
64}
65
66static inline CDS_LFS_RCU_DEPRECATED
67struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s)
68{
69 return _cds_lfs_pop_rcu(s);
70}
71
72#else /* !_LGPL_SOURCE */
73
74extern CDS_LFS_RCU_DEPRECATED
75void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node);
76extern CDS_LFS_RCU_DEPRECATED
77void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s);
78extern CDS_LFS_RCU_DEPRECATED
79int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
80 struct cds_lfs_node_rcu *node);
81
82/*
83 * Should be called under rcu read lock critical section.
84 *
85 * The caller must wait for a grace period to pass before freeing the returned
86 * node or modifying the cds_lfs_node_rcu structure.
87 * Returns NULL if stack is empty.
88 */
89extern CDS_LFS_RCU_DEPRECATED
90struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s);
91
92#endif /* !_LGPL_SOURCE */
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* _URCU_RCULFSTACK_H */
This page took 0.025885 seconds and 4 git commands to generate.