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 QSBR header.
12 * LGPL-compatible code should include this header with :
14 * #define _LGPL_SOURCE
17 * IBM's contributions to this file may be relicensed under LGPLv2 or later.
24 #include <urcu/config.h>
27 * See urcu/pointer.h and urcu/static/pointer.h for pointer
28 * publication headers.
30 #include <urcu/pointer.h>
31 #include <urcu/urcu-poll.h>
37 #include <urcu/map/urcu-qsbr.h>
39 #ifdef RCU_DEBUG /* For backward compatibility */
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.
53 #include <urcu/static/urcu-qsbr.h>
56 * Mappings for static use of the userspace RCU library.
57 * Should only be used in LGPL-compatible code.
64 * Mark the beginning and end of a read-side critical section.
65 * DON'T FORGET TO USE rcu_register_thread/rcu_unregister_thread()
66 * FOR EACH THREAD WITH READ-SIDE CRITICAL SECTION.
68 #define urcu_qsbr_read_lock _urcu_qsbr_read_lock
69 #define urcu_qsbr_read_unlock _urcu_qsbr_read_unlock
70 #define urcu_qsbr_read_ongoing _urcu_qsbr_read_ongoing
72 #define urcu_qsbr_quiescent_state _urcu_qsbr_quiescent_state
73 #define urcu_qsbr_thread_offline _urcu_qsbr_thread_offline
74 #define urcu_qsbr_thread_online _urcu_qsbr_thread_online
76 #else /* !_LGPL_SOURCE */
79 * library wrappers to be used by non-LGPL compatible source code.
83 * QSBR read lock/unlock are guaranteed to be no-ops. Therefore, we expose them
84 * in the LGPL header for any code to use. However, the debug version is not
85 * nops and may contain sanity checks. To activate it, applications must be
86 * recompiled with -DDEBUG_RCU (even non-LGPL/GPL applications), or
87 * compiled against a urcu/config.h that has CONFIG_RCU_DEBUG defined.
88 * This is the best trade-off between license/performance/code
89 * triviality and library debugging & tracing features we could come up
93 #if (!defined(BUILD_QSBR_LIB) && !defined(DEBUG_RCU) && !defined(CONFIG_RCU_DEBUG))
95 static inline void urcu_qsbr_read_lock(void)
99 static inline void urcu_qsbr_read_unlock(void)
103 #else /* #if (!defined(BUILD_QSBR_LIB) && !defined(DEBUG_RCU) && !defined(CONFIG_RCU_DEBUG)) */
105 extern void urcu_qsbr_read_lock(void);
106 extern void urcu_qsbr_read_unlock(void);
108 #endif /* #else #if (!defined(BUILD_QSBR_LIB) && !defined(DEBUG_RCU) && !defined(CONFIG_RCU_DEBUG)) */
110 extern int urcu_qsbr_read_ongoing(void);
111 extern void urcu_qsbr_quiescent_state(void);
112 extern void urcu_qsbr_thread_offline(void);
113 extern void urcu_qsbr_thread_online(void);
115 #endif /* !_LGPL_SOURCE */
117 extern void urcu_qsbr_synchronize_rcu(void);
120 * RCU grace period polling API.
122 extern struct urcu_gp_poll_state
urcu_qsbr_start_poll_synchronize_rcu(void);
123 extern bool urcu_qsbr_poll_state_synchronize_rcu(struct urcu_gp_poll_state state
);
126 * Reader thread registration.
128 extern void urcu_qsbr_register_thread(void);
129 extern void urcu_qsbr_unregister_thread(void);
135 #include <urcu/call-rcu.h>
136 #include <urcu/defer.h>
137 #include <urcu/flavor.h>
140 #include <urcu/map/clear.h>
143 #endif /* _URCU_QSBR_H */
This page took 0.031709 seconds and 4 git commands to generate.