Commit | Line | Data |
---|---|---|
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 | ||
35 | /* | |
36 | * Important ! | |
37 | * | |
38 | * Each thread queuing memory reclamation must be registered with | |
786ee85b | 39 | * rcu_defer_register_thread(). rcu_defer_unregister_thread() should be |
90075a50 MD |
40 | * called before the thread exits. |
41 | */ | |
42 | ||
43 | #ifdef _LGPL_SOURCE | |
44 | ||
786ee85b | 45 | #include <urcu-defer-static.h> |
90075a50 MD |
46 | |
47 | /* | |
48 | * Mappings for static use of the userspace RCU library. | |
49 | * Should only be used in LGPL-compatible code. | |
50 | */ | |
51 | ||
786ee85b | 52 | #define rcu_defer_queue _rcu_defer_queue |
90075a50 MD |
53 | |
54 | #else /* !_LGPL_SOURCE */ | |
55 | ||
56 | /* | |
57 | * library wrappers to be used by non-LGPL compatible source code. | |
58 | */ | |
59 | ||
804b4375 | 60 | extern void rcu_defer_queue(void (*fct)(void *p), void *p); |
90075a50 MD |
61 | |
62 | #endif /* !_LGPL_SOURCE */ | |
63 | ||
804b4375 MD |
64 | #define call_rcu rcu_defer_queue |
65 | #define rcu_reclaim_queue(p) rcu_defer_queue(free, p) | |
66 | ||
90075a50 MD |
67 | /* |
68 | * Thread registration for reclamation. | |
69 | */ | |
786ee85b MD |
70 | extern void rcu_defer_register_thread(void); |
71 | extern void rcu_defer_unregister_thread(void); | |
72 | extern void rcu_defer_barrier(void); | |
73 | extern void rcu_defer_barrier_thread(void); | |
90075a50 | 74 | |
786ee85b | 75 | #endif /* _URCU_BATCH_H */ |