1 // SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 // SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation.
4 // SPDX-License-Identifier: LGPL-2.1-or-later
10 * Userspace RCU header, "bulletproof" version.
12 * Slower RCU read-side adapted for tracing library. Does not require thread
13 * registration nor unregistration. Also signal-safe.
15 * LGPL-compatible code should include this header with :
17 * #define _LGPL_SOURCE
20 * IBM's contributions to this file may be relicensed under LGPLv2 or later.
27 #include <urcu/map/urcu-bp.h>
32 * Each thread containing read-side critical sections must be registered
33 * with rcu_register_thread() before calling rcu_read_lock().
34 * rcu_unregister_thread() should be called before the thread exits.
38 * See urcu/pointer.h and urcu/static/pointer.h for pointer
39 * publication headers.
41 #include <urcu/pointer.h>
42 #include <urcu/urcu-poll.h>
50 #include <urcu/static/urcu-bp.h>
53 * Mappings for static use of the userspace RCU library.
54 * Should only be used in LGPL-compatible code.
61 * Mark the beginning and end of a read-side critical section.
63 #define urcu_bp_read_lock _urcu_bp_read_lock
64 #define urcu_bp_read_unlock _urcu_bp_read_unlock
65 #define urcu_bp_read_ongoing _urcu_bp_read_ongoing
67 #define urcu_bp_dereference rcu_dereference
68 #define urcu_bp_cmpxchg_pointer rcu_cmpxchg_pointer
69 #define urcu_bp_xchg_pointer rcu_xchg_pointer
70 #define urcu_bp_set_pointer rcu_set_pointer
72 #else /* !_LGPL_SOURCE */
75 * library wrappers to be used by non-LGPL compatible source code.
76 * See LGPL-only urcu/static/pointer.h for documentation.
79 extern void urcu_bp_read_lock(void);
80 extern void urcu_bp_read_unlock(void);
81 extern int urcu_bp_read_ongoing(void);
83 extern void *urcu_bp_dereference_sym(void *p
);
84 #define urcu_bp_dereference(p) \
87 __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p), \
88 urcu_bp_dereference_sym(URCU_FORCE_CAST(void *, p))); \
92 extern void *urcu_bp_cmpxchg_pointer_sym(void **p
, void *old
, void *_new
);
93 #define urcu_bp_cmpxchg_pointer(p, old, _new) \
96 __typeof__(*(p)) _________pold = (old); \
97 __typeof__(*(p)) _________pnew = (_new); \
98 __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
99 urcu_bp_cmpxchg_pointer_sym(URCU_FORCE_CAST(void **, p), \
105 extern void *urcu_bp_xchg_pointer_sym(void **p
, void *v
);
106 #define urcu_bp_xchg_pointer(p, v) \
109 __typeof__(*(p)) _________pv = (v); \
110 __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)),\
111 urcu_bp_xchg_pointer_sym(URCU_FORCE_CAST(void **, p), \
116 extern void *urcu_bp_set_pointer_sym(void **p
, void *v
);
117 #define urcu_bp_set_pointer(p, v) \
120 __typeof__(*(p)) _________pv = (v); \
121 __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
122 urcu_bp_set_pointer_sym(URCU_FORCE_CAST(void **, p), \
127 #endif /* !_LGPL_SOURCE */
129 extern void urcu_bp_synchronize_rcu(void);
132 * RCU grace period polling API.
134 extern struct urcu_gp_poll_state
urcu_bp_start_poll_synchronize_rcu(void);
135 extern bool urcu_bp_poll_state_synchronize_rcu(struct urcu_gp_poll_state state
);
138 * urcu_bp_before_fork, urcu_bp_after_fork_parent and urcu_bp_after_fork_child
139 * should be called around fork() system calls when the child process is not
140 * expected to immediately perform an exec(). For pthread users, see
143 extern void urcu_bp_before_fork(void);
144 extern void urcu_bp_after_fork_parent(void);
145 extern void urcu_bp_after_fork_child(void);
148 * In the bulletproof version, thread registration is performed lazily,
149 * but it can be forced by issuing an explicit urcu_bp_register_thread().
151 extern void urcu_bp_register_thread(void);
154 * In the bulletproof version, the following functions are no-ops.
156 static inline void urcu_bp_unregister_thread(void)
160 static inline void urcu_bp_init(void)
165 * Q.S. reporting are no-ops for these URCU flavors.
167 static inline void urcu_bp_quiescent_state(void)
171 static inline void urcu_bp_thread_offline(void)
175 static inline void urcu_bp_thread_online(void)
183 #include <urcu/call-rcu.h>
184 #include <urcu/defer.h>
185 #include <urcu/flavor.h>
188 #include <urcu/map/clear.h>
191 #endif /* _URCU_BP_H */
This page took 0.055203 seconds and 4 git commands to generate.