add uatomic_generic.h, use it for common definitions
[urcu.git] / urcu-defer.h
CommitLineData
786ee85b
MD
1#ifndef _URCU_BATCH_H
2#define _URCU_BATCH_H
90075a50
MD
3
4/*
786ee85b 5 * urcu-defer.h
90075a50 6 *
786ee85b 7 * Userspace RCU header - deferred execution
90075a50
MD
8 *
9 * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
11 *
12 * LGPL-compatible code should include this header with :
13 *
14 * #define _LGPL_SOURCE
786ee85b 15 * #include <urcu-defer.h>
90075a50
MD
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 */
31
32#include <stdlib.h>
33#include <pthread.h>
34
36bc70a8
MD
35#ifdef __cplusplus
36extern "C" {
37#endif
38
90075a50 39/*
3614f13c
MD
40 * Note: the defer_rcu() API is currently EXPERIMENTAL. It may change in the
41 * future.
42 *
90075a50
MD
43 * Important !
44 *
45 * Each thread queuing memory reclamation must be registered with
786ee85b 46 * rcu_defer_register_thread(). rcu_defer_unregister_thread() should be
90075a50 47 * called before the thread exits.
8a13058c 48 *
b4f313b7
MD
49 * *NEVER* use defer_rcu() within a RCU read-side critical section, because this
50 * primitive need to call synchronize_rcu() if the thread queue is full.
90075a50
MD
51 */
52
3614f13c 53extern void defer_rcu(void (*fct)(void *p), void *p);
2c22932b 54
1ed9b677
MD
55/*
56 * call_rcu will eventually be implemented with an API similar to the Linux
57 * kernel call_rcu(), which will allow its use within RCU read-side C.S.
58 * Generate an error if used for now.
59 */
60
61#define call_rcu __error_call_rcu_not_implemented_please_use_defer_rcu
62
90075a50
MD
63/*
64 * Thread registration for reclamation.
65 */
786ee85b
MD
66extern void rcu_defer_register_thread(void);
67extern void rcu_defer_unregister_thread(void);
68extern void rcu_defer_barrier(void);
69extern void rcu_defer_barrier_thread(void);
90075a50 70
36bc70a8
MD
71#ifdef __cplusplus
72}
73#endif
74
786ee85b 75#endif /* _URCU_BATCH_H */
This page took 0.026587 seconds and 4 git commands to generate.