ppc.h: use mftb on ppc
[urcu.git] / include / urcu / urcu-mb.h
CommitLineData
d3d3857f
MJ
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
4477a870
MD
6#ifndef _URCU_MB_H
7#define _URCU_MB_H
27b012e2 8
b257a10b 9/*
b257a10b
MD
10 * Userspace RCU header
11 *
121a5d44 12 * LGPL-compatible code should include this header with :
5e7e64b9 13 *
121a5d44
MD
14 * #define _LGPL_SOURCE
15 * #include <urcu.h>
16 *
54843abc 17 * IBM's contributions to this file may be relicensed under LGPLv2 or later.
b257a10b
MD
18 */
19
1430ee0b 20#include <stdlib.h>
69a757c9 21#include <pthread.h>
111bda8f 22#include <stdbool.h>
1430ee0b 23
7e30abe3 24/*
6cd23d47 25 * See urcu/pointer.h and urcu/static/pointer.h for pointer
af7c2dbe 26 * publication headers.
7e30abe3 27 */
6cd23d47 28#include <urcu/pointer.h>
111bda8f 29#include <urcu/urcu-poll.h>
7e30abe3 30
36bc70a8
MD
31#ifdef __cplusplus
32extern "C" {
67ecffc0 33#endif
36bc70a8 34
4477a870 35#include <urcu/map/urcu-mb.h>
5e77fc1f 36
92b752ee
MD
37/*
38 * Important !
39 *
40 * Each thread containing read-side critical sections must be registered
5e77fc1f
PM
41 * with rcu_register_thread_mb() before calling rcu_read_lock_mb().
42 * rcu_unregister_thread_mb() should be called before the thread exits.
92b752ee
MD
43 */
44
121a5d44 45#ifdef _LGPL_SOURCE
b0d5e790 46
4477a870 47#include <urcu/static/urcu-mb.h>
3a86deba
MD
48
49/*
121a5d44
MD
50 * Mappings for static use of the userspace RCU library.
51 * Should only be used in LGPL-compatible code.
3a86deba 52 */
3a86deba 53
7e30abe3
MD
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 */
4477a870
MD
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
41718ff9 65
121a5d44 66#else /* !_LGPL_SOURCE */
27b012e2 67
40e140c9 68/*
121a5d44 69 * library wrappers to be used by non-LGPL compatible source code.
6cd23d47 70 * See LGPL-only urcu/static/pointer.h for documentation.
40e140c9 71 */
cf380c2f 72
4477a870
MD
73extern void urcu_mb_read_lock(void);
74extern void urcu_mb_read_unlock(void);
75extern int urcu_mb_read_ongoing(void);
cf380c2f 76
121a5d44 77#endif /* !_LGPL_SOURCE */
f4a486ac 78
4477a870 79extern void urcu_mb_synchronize_rcu(void);
27b012e2 80
111bda8f
MD
81/*
82 * RCU grace period polling API.
83 */
84extern struct urcu_gp_poll_state urcu_mb_start_poll_synchronize_rcu(void);
85extern bool urcu_mb_poll_state_synchronize_rcu(struct urcu_gp_poll_state state);
86
27b012e2
MD
87/*
88 * Reader thread registration.
89 */
4477a870
MD
90extern void urcu_mb_register_thread(void);
91extern void urcu_mb_unregister_thread(void);
27b012e2 92
e95f4e7f 93/*
02be5561 94 * Explicit rcu initialization, for "early" use within library constructors.
e95f4e7f 95 */
4477a870 96extern void urcu_mb_init(void);
e95f4e7f 97
51b03c6f
MD
98/*
99 * Q.S. reporting are no-ops for these URCU flavors.
100 */
4477a870 101static inline void urcu_mb_quiescent_state(void)
51b03c6f
MD
102{
103}
104
4477a870 105static inline void urcu_mb_thread_offline(void)
51b03c6f
MD
106{
107}
108
4477a870 109static inline void urcu_mb_thread_online(void)
51b03c6f
MD
110{
111}
112
67ecffc0 113#ifdef __cplusplus
36bc70a8
MD
114}
115#endif
116
6cd23d47
MD
117#include <urcu/call-rcu.h>
118#include <urcu/defer.h>
119#include <urcu/flavor.h>
5e77fc1f 120
4477a870
MD
121#ifndef URCU_API_MAP
122#include <urcu/map/clear.h>
123#endif
124
125#endif /* _URCU_MB_H */
This page took 0.060387 seconds and 4 git commands to generate.