rculfhash: make cds_lfht_iter_get_node argument const
[userspace-rcu.git] / include / urcu / urcu-mb.h
1 // SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 // SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
3 //
4 // SPDX-License-Identifier: LGPL-2.1-or-later
5
6 #ifndef _URCU_MB_H
7 #define _URCU_MB_H
8
9 /*
10 * Userspace RCU header
11 *
12 * LGPL-compatible code should include this header with :
13 *
14 * #define _LGPL_SOURCE
15 * #include <urcu.h>
16 *
17 * IBM's contributions to this file may be relicensed under LGPLv2 or later.
18 */
19
20 #include <stdlib.h>
21 #include <pthread.h>
22 #include <stdbool.h>
23
24 /*
25 * See urcu/pointer.h and urcu/static/pointer.h for pointer
26 * publication headers.
27 */
28 #include <urcu/pointer.h>
29 #include <urcu/urcu-poll.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <urcu/map/urcu-mb.h>
36
37 /*
38 * Important !
39 *
40 * Each thread containing read-side critical sections must be registered
41 * with rcu_register_thread_mb() before calling rcu_read_lock_mb().
42 * rcu_unregister_thread_mb() should be called before the thread exits.
43 */
44
45 #ifdef _LGPL_SOURCE
46
47 #include <urcu/static/urcu-mb.h>
48
49 /*
50 * Mappings for static use of the userspace RCU library.
51 * Should only be used in LGPL-compatible code.
52 */
53
54 /*
55 * rcu_read_lock()
56 * rcu_read_unlock()
57 *
58 * Mark the beginning and end of a read-side critical section.
59 * DON'T FORGET TO USE RCU_REGISTER/UNREGISTER_THREAD() FOR EACH THREAD WITH
60 * READ-SIDE CRITICAL SECTION.
61 */
62 #define urcu_mb_read_lock _urcu_mb_read_lock
63 #define urcu_mb_read_unlock _urcu_mb_read_unlock
64 #define urcu_mb_read_ongoing _urcu_mb_read_ongoing
65
66 #else /* !_LGPL_SOURCE */
67
68 /*
69 * library wrappers to be used by non-LGPL compatible source code.
70 * See LGPL-only urcu/static/pointer.h for documentation.
71 */
72
73 extern void urcu_mb_read_lock(void);
74 extern void urcu_mb_read_unlock(void);
75 extern int urcu_mb_read_ongoing(void);
76
77 #endif /* !_LGPL_SOURCE */
78
79 extern void urcu_mb_synchronize_rcu(void);
80
81 /*
82 * RCU grace period polling API.
83 */
84 extern struct urcu_gp_poll_state urcu_mb_start_poll_synchronize_rcu(void);
85 extern bool urcu_mb_poll_state_synchronize_rcu(struct urcu_gp_poll_state state);
86
87 /*
88 * Reader thread registration.
89 */
90 extern void urcu_mb_register_thread(void);
91 extern void urcu_mb_unregister_thread(void);
92
93 /*
94 * Explicit rcu initialization, for "early" use within library constructors.
95 */
96 extern void urcu_mb_init(void);
97
98 /*
99 * Q.S. reporting are no-ops for these URCU flavors.
100 */
101 static inline void urcu_mb_quiescent_state(void)
102 {
103 }
104
105 static inline void urcu_mb_thread_offline(void)
106 {
107 }
108
109 static inline void urcu_mb_thread_online(void)
110 {
111 }
112
113 #ifdef __cplusplus
114 }
115 #endif
116
117 #include <urcu/call-rcu.h>
118 #include <urcu/defer.h>
119 #include <urcu/flavor.h>
120
121 #ifndef URCU_API_MAP
122 #include <urcu/map/clear.h>
123 #endif
124
125 #endif /* _URCU_MB_H */
This page took 0.031876 seconds and 4 git commands to generate.