urcu-memb,mb,signal: Implement grace period polling
[userspace-rcu.git] / include / urcu / flavor.h
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
26 #include <urcu/urcu-poll.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 struct rcu_head;
33
34 struct 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
41 void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork);
42 void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork);
43
44 struct rcu_flavor_struct {
45 void (*read_lock)(void);
46 void (*read_unlock)(void);
47 int (*read_ongoing)(void);
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);
58
59 void (*barrier)(void);
60
61 void (*register_rculfhash_atfork)(struct urcu_atfork *atfork);
62 void (*unregister_rculfhash_atfork)(struct urcu_atfork *atfork);
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);
66 };
67
68 #define DEFINE_RCU_FLAVOR(x) \
69 const struct rcu_flavor_struct x = { \
70 .read_lock = rcu_read_lock, \
71 .read_unlock = rcu_read_unlock, \
72 .read_ongoing = rcu_read_ongoing, \
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,\
81 .barrier = rcu_barrier, \
82 .register_rculfhash_atfork = urcu_register_rculfhash_atfork, \
83 .unregister_rculfhash_atfork = urcu_unregister_rculfhash_atfork,\
84 .update_start_poll_synchronize_rcu = start_poll_synchronize_rcu,\
85 .update_poll_state_synchronize_rcu = poll_state_synchronize_rcu,\
86 }
87
88 extern const struct rcu_flavor_struct rcu_flavor;
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif /* _URCU_FLAVOR_H */
This page took 0.032843 seconds and 5 git commands to generate.