rculfhash: Ensure future-proof memory barrier semantic consistency
[urcu.git] / urcu / wfstack.h
CommitLineData
cb3f3d6b
MD
1#ifndef _URCU_WFSTACK_H
2#define _URCU_WFSTACK_H
3
4/*
294d3396 5 * wfstack.h
cb3f3d6b
MD
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
31extern "C" {
32#endif
33
16aa9ee8
DG
34struct cds_wfs_node {
35 struct cds_wfs_node *next;
cb3f3d6b
MD
36};
37
16aa9ee8
DG
38struct cds_wfs_stack {
39 struct cds_wfs_node *head;
cb3f3d6b
MD
40 pthread_mutex_t lock;
41};
42
294d3396 43#ifdef _LGPL_SOURCE
cb3f3d6b 44
af7c2dbe 45#include <urcu/static/wfstack.h>
cb3f3d6b 46
16aa9ee8
DG
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
cb3f3d6b 52
294d3396 53#else /* !_LGPL_SOURCE */
cb3f3d6b 54
16aa9ee8
DG
55extern void cds_wfs_node_init(struct cds_wfs_node *node);
56extern void cds_wfs_init(struct cds_wfs_stack *s);
191098fc 57extern int cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node);
16aa9ee8
DG
58/* __cds_wfs_pop_blocking: caller ensures mutual exclusion between pops */
59extern struct cds_wfs_node *__cds_wfs_pop_blocking(struct cds_wfs_stack *s);
60extern struct cds_wfs_node *cds_wfs_pop_blocking(struct cds_wfs_stack *s);
cb3f3d6b 61
294d3396 62#endif /* !_LGPL_SOURCE */
cb3f3d6b
MD
63
64#ifdef __cplusplus
65}
66#endif
67
68#endif /* _URCU_WFSTACK_H */
This page took 0.030064 seconds and 4 git commands to generate.