7 * Userspace RCU header, "bulletproof" version.
9 * Slower RCU read-side adapted for tracing library. Does not require thread
10 * registration nor unregistration. Also signal-safe.
12 * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
15 * LGPL-compatible code should include this header with :
17 * #define _LGPL_SOURCE
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
25 * This library is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
34 * IBM's contributions to this file may be relicensed under LGPLv2 or later.
41 #include <urcu/map/urcu-bp.h>
46 * Each thread containing read-side critical sections must be registered
47 * with rcu_register_thread() before calling rcu_read_lock().
48 * rcu_unregister_thread() should be called before the thread exits.
52 * See urcu/pointer.h and urcu/static/pointer.h for pointer
53 * publication headers.
55 #include <urcu/pointer.h>
56 #include <urcu/urcu-poll.h>
64 #include <urcu/static/urcu-bp.h>
67 * Mappings for static use of the userspace RCU library.
68 * Should only be used in LGPL-compatible code.
75 * Mark the beginning and end of a read-side critical section.
77 #define urcu_bp_read_lock _urcu_bp_read_lock
78 #define urcu_bp_read_unlock _urcu_bp_read_unlock
79 #define urcu_bp_read_ongoing _urcu_bp_read_ongoing
81 #define urcu_bp_dereference rcu_dereference
82 #define urcu_bp_cmpxchg_pointer rcu_cmpxchg_pointer
83 #define urcu_bp_xchg_pointer rcu_xchg_pointer
84 #define urcu_bp_set_pointer rcu_set_pointer
86 #else /* !_LGPL_SOURCE */
89 * library wrappers to be used by non-LGPL compatible source code.
90 * See LGPL-only urcu/static/pointer.h for documentation.
93 extern void urcu_bp_read_lock(void);
94 extern void urcu_bp_read_unlock(void);
95 extern int urcu_bp_read_ongoing(void);
97 extern void *urcu_bp_dereference_sym(void *p
);
98 #define urcu_bp_dereference(p) \
101 __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p), \
102 urcu_bp_dereference_sym(URCU_FORCE_CAST(void *, p))); \
106 extern void *urcu_bp_cmpxchg_pointer_sym(void **p
, void *old
, void *_new
);
107 #define urcu_bp_cmpxchg_pointer(p, old, _new) \
110 __typeof__(*(p)) _________pold = (old); \
111 __typeof__(*(p)) _________pnew = (_new); \
112 __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
113 urcu_bp_cmpxchg_pointer_sym(URCU_FORCE_CAST(void **, p), \
119 extern void *urcu_bp_xchg_pointer_sym(void **p
, void *v
);
120 #define urcu_bp_xchg_pointer(p, v) \
123 __typeof__(*(p)) _________pv = (v); \
124 __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)),\
125 urcu_bp_xchg_pointer_sym(URCU_FORCE_CAST(void **, p), \
130 extern void *urcu_bp_set_pointer_sym(void **p
, void *v
);
131 #define urcu_bp_set_pointer(p, v) \
134 __typeof__(*(p)) _________pv = (v); \
135 __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
136 urcu_bp_set_pointer_sym(URCU_FORCE_CAST(void **, p), \
141 #endif /* !_LGPL_SOURCE */
143 extern void urcu_bp_synchronize_rcu(void);
146 * RCU grace period polling API.
148 extern struct urcu_gp_poll_state
urcu_bp_start_poll_synchronize_rcu(void);
149 extern bool urcu_bp_poll_state_synchronize_rcu(struct urcu_gp_poll_state state
);
152 * urcu_bp_before_fork, urcu_bp_after_fork_parent and urcu_bp_after_fork_child
153 * should be called around fork() system calls when the child process is not
154 * expected to immediately perform an exec(). For pthread users, see
157 extern void urcu_bp_before_fork(void);
158 extern void urcu_bp_after_fork_parent(void);
159 extern void urcu_bp_after_fork_child(void);
162 * In the bulletproof version, thread registration is performed lazily,
163 * but it can be forced by issuing an explicit urcu_bp_register_thread().
165 extern void urcu_bp_register_thread(void);
168 * In the bulletproof version, the following functions are no-ops.
170 static inline void urcu_bp_unregister_thread(void)
174 static inline void urcu_bp_init(void)
179 * Q.S. reporting are no-ops for these URCU flavors.
181 static inline void urcu_bp_quiescent_state(void)
185 static inline void urcu_bp_thread_offline(void)
189 static inline void urcu_bp_thread_online(void)
197 #include <urcu/call-rcu.h>
198 #include <urcu/defer.h>
199 #include <urcu/flavor.h>
202 #include <urcu/map/clear.h>
205 #endif /* _URCU_BP_H */
This page took 0.035746 seconds and 4 git commands to generate.