rculfstack: LGPL-ize
[urcu.git] / 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
0e2e9380
MD
26#ifdef __cplusplus
27extern "C" {
28#endif
29
453629a9
MD
30struct rcu_lfs_node {
31 struct rcu_lfs_node *next;
32};
33
34struct rcu_lfs_stack {
35 struct rcu_lfs_node *head;
36};
37
b6a37eac 38#ifdef _LGPL_SOURCE
453629a9 39
b6a37eac 40#include <urcu/rculfstack-static.h>
453629a9 41
b6a37eac
MD
42#define rcu_lfs_node_init _rcu_lfs_node_init
43#define rcu_lfs_init _rcu_lfs_init
44#define rcu_lfs_push _rcu_lfs_push
45#define rcu_lfs_pop _rcu_lfs_pop
453629a9 46
b6a37eac
MD
47#else /* !_LGPL_SOURCE */
48
49extern void rcu_lfs_node_init(struct rcu_lfs_node *node);
50extern void rcu_lfs_init(struct rcu_lfs_stack *s);
51extern void rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node *node);
453629a9 52
1c1e940e
MD
53/*
54 * The caller must wait for a grace period to pass before freeing the returned
c97740a3 55 * node or modifying the rcu_lfs_node structure.
1c1e940e
MD
56 * Returns NULL if stack is empty.
57 */
b6a37eac 58extern struct rcu_lfs_node *rcu_lfs_pop(struct rcu_lfs_stack *s);
453629a9 59
b6a37eac 60#endif /* !_LGPL_SOURCE */
c3f74cb2 61
0e2e9380
MD
62#ifdef __cplusplus
63}
64#endif
65
c3f74cb2 66#endif /* _URCU_RCULFSTACK_H */
This page took 0.024785 seconds and 4 git commands to generate.