Public headers: use SPDX identifiers
[urcu.git] / include / urcu / rculfstack.h
CommitLineData
d3d3857f
MJ
1// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
c3f74cb2
MD
5#ifndef _URCU_RCULFSTACK_H
6#define _URCU_RCULFSTACK_H
7
453629a9 8/*
453629a9 9 * Userspace RCU library - Lock-Free RCU Stack
453629a9
MD
10 */
11
706d1165
MD
12#include <urcu/compiler.h>
13
0e2e9380
MD
14#ifdef __cplusplus
15extern "C" {
16#endif
17
d89ec762
MD
18#ifndef CDS_LFS_RCU_DEPRECATED
19#define CDS_LFS_RCU_DEPRECATED \
706d1165 20 CDS_DEPRECATED("urcu/rculfstack.h is deprecated. Please use urcu/lfstack.h instead.")
d89ec762
MD
21#endif
22
16aa9ee8
DG
23struct cds_lfs_node_rcu {
24 struct cds_lfs_node_rcu *next;
453629a9
MD
25};
26
16aa9ee8
DG
27struct cds_lfs_stack_rcu {
28 struct cds_lfs_node_rcu *head;
453629a9
MD
29};
30
b6a37eac 31#ifdef _LGPL_SOURCE
453629a9 32
af7c2dbe 33#include <urcu/static/rculfstack.h>
453629a9 34
d89ec762
MD
35static inline CDS_LFS_RCU_DEPRECATED
36void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node)
37{
38 _cds_lfs_node_init_rcu(node);
39}
40
41static inline
42void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s)
43{
44 _cds_lfs_init_rcu(s);
45}
46
47static inline CDS_LFS_RCU_DEPRECATED
48int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
49 struct cds_lfs_node_rcu *node)
50{
51 return _cds_lfs_push_rcu(s, node);
52}
53
54static inline CDS_LFS_RCU_DEPRECATED
55struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s)
56{
57 return _cds_lfs_pop_rcu(s);
58}
453629a9 59
b6a37eac
MD
60#else /* !_LGPL_SOURCE */
61
d89ec762
MD
62extern CDS_LFS_RCU_DEPRECATED
63void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node);
64extern CDS_LFS_RCU_DEPRECATED
65void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s);
66extern CDS_LFS_RCU_DEPRECATED
67int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
e1a3b81e 68 struct cds_lfs_node_rcu *node);
453629a9 69
1c1e940e 70/*
6e5f88cf 71 * Should be called under rcu read lock critical section.
d9b52143 72 *
1c1e940e 73 * The caller must wait for a grace period to pass before freeing the returned
16aa9ee8 74 * node or modifying the cds_lfs_node_rcu structure.
1c1e940e
MD
75 * Returns NULL if stack is empty.
76 */
d89ec762
MD
77extern CDS_LFS_RCU_DEPRECATED
78struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s);
453629a9 79
b6a37eac 80#endif /* !_LGPL_SOURCE */
c3f74cb2 81
0e2e9380
MD
82#ifdef __cplusplus
83}
84#endif
85
c3f74cb2 86#endif /* _URCU_RCULFSTACK_H */
This page took 0.052497 seconds and 4 git commands to generate.