Build system: use SPDX identifiers
[userspace-rcu.git] / include / urcu / flavor.h
CommitLineData
541d828d
LJ
1#ifndef _URCU_FLAVOR_H
2#define _URCU_FLAVOR_H
3
4/*
5 * urcu-flavor.h
6 *
7 * Userspace RCU header - rcu flavor declarations
8 *
9 * Copyright (c) 2011 Lai Jiangshan <laijs@cn.fujitsu.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
111bda8f
MD
26#include <urcu/urcu-poll.h>
27
541d828d
LJ
28#ifdef __cplusplus
29extern "C" {
30#endif
31
6bcce235
MD
32struct rcu_head;
33
d0ec0ed2
MD
34struct urcu_atfork {
35 void (*before_fork)(void *priv);
36 void (*after_fork_parent)(void *priv);
37 void (*after_fork_child)(void *priv);
38 void *priv;
39};
40
41void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork);
42void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork);
43
541d828d
LJ
44struct rcu_flavor_struct {
45 void (*read_lock)(void);
46 void (*read_unlock)(void);
882f3357 47 int (*read_ongoing)(void);
541d828d
LJ
48 void (*read_quiescent_state)(void);
49 void (*update_call_rcu)(struct rcu_head *head,
50 void (*func)(struct rcu_head *head));
51 void (*update_synchronize_rcu)(void);
52 void (*update_defer_rcu)(void (*fct)(void *p), void *p);
53
54 void (*thread_offline)(void);
55 void (*thread_online)(void);
56 void (*register_thread)(void);
57 void (*unregister_thread)(void);
b7f721d9
MD
58
59 void (*barrier)(void);
d0ec0ed2
MD
60
61 void (*register_rculfhash_atfork)(struct urcu_atfork *atfork);
62 void (*unregister_rculfhash_atfork)(struct urcu_atfork *atfork);
111bda8f
MD
63
64 struct urcu_gp_poll_state (*update_start_poll_synchronize_rcu)(void);
65 bool (*update_poll_state_synchronize_rcu)(struct urcu_gp_poll_state state);
541d828d
LJ
66};
67
5e6b23a6
MD
68#define DEFINE_RCU_FLAVOR(x) \
69const struct rcu_flavor_struct x = { \
541d828d
LJ
70 .read_lock = rcu_read_lock, \
71 .read_unlock = rcu_read_unlock, \
882f3357 72 .read_ongoing = rcu_read_ongoing, \
541d828d
LJ
73 .read_quiescent_state = rcu_quiescent_state, \
74 .update_call_rcu = call_rcu, \
75 .update_synchronize_rcu = synchronize_rcu, \
76 .update_defer_rcu = defer_rcu, \
77 .thread_offline = rcu_thread_offline, \
78 .thread_online = rcu_thread_online, \
79 .register_thread = rcu_register_thread, \
80 .unregister_thread = rcu_unregister_thread,\
b7f721d9 81 .barrier = rcu_barrier, \
d0ec0ed2
MD
82 .register_rculfhash_atfork = urcu_register_rculfhash_atfork, \
83 .unregister_rculfhash_atfork = urcu_unregister_rculfhash_atfork,\
111bda8f
MD
84 .update_start_poll_synchronize_rcu = start_poll_synchronize_rcu,\
85 .update_poll_state_synchronize_rcu = poll_state_synchronize_rcu,\
5e6b23a6 86}
541d828d
LJ
87
88extern const struct rcu_flavor_struct rcu_flavor;
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif /* _URCU_FLAVOR_H */
This page took 0.047897 seconds and 4 git commands to generate.