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