urcu tests: use lib rather than compile from source
[userspace-rcu.git] / urcu-call-rcu.h
CommitLineData
b57aee66
PM
1#ifndef _URCU_CALL_RCU_H
2#define _URCU_CALL_RCU_H
3
4/*
5 * urcu-call-rcu.h
6 *
7 * Userspace RCU header - deferred execution
8 *
9 * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
11 *
12 * LGPL-compatible code should include this header with :
13 *
14 * #define _LGPL_SOURCE
15 * #include <urcu-defer.h>
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 */
31
32#include <stdlib.h>
33#include <pthread.h>
34
5161f31e 35#include <urcu/wfcqueue.h>
b57aee66
PM
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/* Note that struct call_rcu_data is opaque to callers. */
42
43struct call_rcu_data;
44
45/* Flag values. */
46
e85451a1
MD
47#define URCU_CALL_RCU_RT (1U << 0)
48#define URCU_CALL_RCU_RUNNING (1U << 1)
49#define URCU_CALL_RCU_STOP (1U << 2)
50#define URCU_CALL_RCU_STOPPED (1U << 3)
51#define URCU_CALL_RCU_PAUSE (1U << 4)
52#define URCU_CALL_RCU_PAUSED (1U << 5)
b57aee66
PM
53
54/*
55 * The rcu_head data structure is placed in the structure to be freed
56 * via call_rcu().
57 */
58
59struct rcu_head {
5161f31e 60 struct cds_wfcq_node next;
b57aee66
PM
61 void (*func)(struct rcu_head *head);
62};
63
64/*
65 * Exported functions
f9da0936 66 *
37a9ce52
MD
67 * Important: see rcu-api.txt in userspace-rcu documentation for
68 * call_rcu family of functions usage detail, including the surrounding
69 * RCU usage required when using these primitives.
b57aee66 70 */
618b2595 71
f9da0936
MD
72void call_rcu(struct rcu_head *head,
73 void (*func)(struct rcu_head *head));
74
c1d2c60b
MD
75struct call_rcu_data *create_call_rcu_data(unsigned long flags,
76 int cpu_affinity);
f9da0936
MD
77void call_rcu_data_free(struct call_rcu_data *crdp);
78
b57aee66 79struct call_rcu_data *get_default_call_rcu_data(void);
f9da0936 80struct call_rcu_data *get_cpu_call_rcu_data(int cpu);
b57aee66 81struct call_rcu_data *get_thread_call_rcu_data(void);
f9da0936
MD
82struct call_rcu_data *get_call_rcu_data(void);
83pthread_t get_call_rcu_thread(struct call_rcu_data *crdp);
84
b57aee66 85void set_thread_call_rcu_data(struct call_rcu_data *crdp);
f9da0936
MD
86int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp);
87
b57aee66 88int create_all_cpu_call_rcu_data(unsigned long flags);
7106ddf8 89void free_all_cpu_call_rcu_data(void);
f9da0936 90
666d90e8
MD
91void call_rcu_before_fork(void);
92void call_rcu_after_fork_parent(void);
7106ddf8 93void call_rcu_after_fork_child(void);
b57aee66 94
b7f721d9
MD
95void rcu_barrier(void);
96
b57aee66
PM
97#ifdef __cplusplus
98}
99#endif
100
101#endif /* _URCU_CALL_RCU_H */
This page took 0.036098 seconds and 4 git commands to generate.