Add CMM memory model
[urcu.git] / include / urcu / urcu-signal.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_SIGNAL_H
7 #define _URCU_SIGNAL_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-signal.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-signal.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_signal_read_lock _urcu_signal_read_lock
63 #define urcu_signal_read_unlock _urcu_signal_read_unlock
64 #define urcu_signal_read_ongoing _urcu_signal_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_signal_read_lock(void);
74 extern void urcu_signal_read_unlock(void);
75 extern int urcu_signal_read_ongoing(void);
76
77 #endif /* !_LGPL_SOURCE */
78
79 extern void urcu_signal_synchronize_rcu(void);
80
81 /*
82 * RCU grace period polling API.
83 */
84 extern struct urcu_gp_poll_state urcu_signal_start_poll_synchronize_rcu(void);
85 extern bool urcu_signal_poll_state_synchronize_rcu(struct urcu_gp_poll_state state);
86
87 /*
88 * Reader thread registration.
89 */
90 extern void urcu_signal_register_thread(void);
91 extern void urcu_signal_unregister_thread(void);
92
93 /*
94 * Explicit rcu initialization, for "early" use within library constructors.
95 */
96 extern void urcu_signal_init(void);
97
98 /*
99 * Q.S. reporting are no-ops for these URCU flavors.
100 */
101 static inline void urcu_signal_quiescent_state(void)
102 {
103 }
104
105 static inline void urcu_signal_thread_offline(void)
106 {
107 }
108
109 static inline void urcu_signal_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_SIGNAL_H */
This page took 0.032281 seconds and 4 git commands to generate.