urcu-bp: Update fork() handling
[urcu.git] / urcu / wfstack.h
1 #ifndef _URCU_WFSTACK_H
2 #define _URCU_WFSTACK_H
3
4 /*
5 * wfstack.h
6 *
7 * Userspace RCU library - Stack with Wait-Free push, Blocking pop.
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 #include <pthread.h>
27 #include <assert.h>
28 #include <urcu/compiler.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 struct cds_wfs_node {
35 struct cds_wfs_node *next;
36 };
37
38 struct cds_wfs_stack {
39 struct cds_wfs_node *head;
40 pthread_mutex_t lock;
41 };
42
43 #ifdef _LGPL_SOURCE
44
45 #include <urcu/wfstack-static.h>
46
47 #define cds_wfs_node_init _cds_wfs_node_init
48 #define cds_wfs_init _cds_wfs_init
49 #define cds_wfs_push _cds_wfs_push
50 #define __cds_wfs_pop_blocking ___cds_wfs_pop_blocking
51 #define cds_wfs_pop_blocking _cds_wfs_pop_blocking
52
53 #else /* !_LGPL_SOURCE */
54
55 extern void cds_wfs_node_init(struct cds_wfs_node *node);
56 extern void cds_wfs_init(struct cds_wfs_stack *s);
57 extern void cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node);
58 /* __cds_wfs_pop_blocking: caller ensures mutual exclusion between pops */
59 extern struct cds_wfs_node *__cds_wfs_pop_blocking(struct cds_wfs_stack *s);
60 extern struct cds_wfs_node *cds_wfs_pop_blocking(struct cds_wfs_stack *s);
61
62 #endif /* !_LGPL_SOURCE */
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif /* _URCU_WFSTACK_H */
This page took 0.030835 seconds and 4 git commands to generate.