ppc.h: use mftb on ppc
[urcu.git] / include / urcu / call-rcu.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
b57aee66
PM
6#ifndef _URCU_CALL_RCU_H
7#define _URCU_CALL_RCU_H
8
9/*
89d19b43 10 * Userspace RCU header - batch memory reclamation with kernel API
b57aee66 11 *
89d19b43
MD
12 * This header is meant to be included indirectly through a liburcu
13 * flavor header.
b57aee66
PM
14 */
15
16#include <stdlib.h>
17#include <pthread.h>
18
5161f31e 19#include <urcu/wfcqueue.h>
b57aee66
PM
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/* Note that struct call_rcu_data is opaque to callers. */
26
27struct call_rcu_data;
28
29/* Flag values. */
30
e85451a1
MD
31#define URCU_CALL_RCU_RT (1U << 0)
32#define URCU_CALL_RCU_RUNNING (1U << 1)
33#define URCU_CALL_RCU_STOP (1U << 2)
34#define URCU_CALL_RCU_STOPPED (1U << 3)
35#define URCU_CALL_RCU_PAUSE (1U << 4)
36#define URCU_CALL_RCU_PAUSED (1U << 5)
b57aee66
PM
37
38/*
39 * The rcu_head data structure is placed in the structure to be freed
40 * via call_rcu().
41 */
42
43struct rcu_head {
5161f31e 44 struct cds_wfcq_node next;
b57aee66
PM
45 void (*func)(struct rcu_head *head);
46};
47
48/*
49 * Exported functions
f9da0936 50 *
dcb9c05a 51 * Important: see rcu-api.md in userspace-rcu documentation for
37a9ce52
MD
52 * call_rcu family of functions usage detail, including the surrounding
53 * RCU usage required when using these primitives.
b57aee66 54 */
618b2595 55
f9da0936
MD
56void call_rcu(struct rcu_head *head,
57 void (*func)(struct rcu_head *head));
58
c1d2c60b
MD
59struct call_rcu_data *create_call_rcu_data(unsigned long flags,
60 int cpu_affinity);
f9da0936
MD
61void call_rcu_data_free(struct call_rcu_data *crdp);
62
b57aee66 63struct call_rcu_data *get_default_call_rcu_data(void);
f9da0936 64struct call_rcu_data *get_cpu_call_rcu_data(int cpu);
b57aee66 65struct call_rcu_data *get_thread_call_rcu_data(void);
f9da0936
MD
66struct call_rcu_data *get_call_rcu_data(void);
67pthread_t get_call_rcu_thread(struct call_rcu_data *crdp);
68
b57aee66 69void set_thread_call_rcu_data(struct call_rcu_data *crdp);
f9da0936
MD
70int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp);
71
b57aee66 72int create_all_cpu_call_rcu_data(unsigned long flags);
7106ddf8 73void free_all_cpu_call_rcu_data(void);
f9da0936 74
666d90e8
MD
75void call_rcu_before_fork(void);
76void call_rcu_after_fork_parent(void);
7106ddf8 77void call_rcu_after_fork_child(void);
b57aee66 78
b7f721d9
MD
79void rcu_barrier(void);
80
67ecffc0 81#ifdef __cplusplus
b57aee66
PM
82}
83#endif
84
85#endif /* _URCU_CALL_RCU_H */
This page took 0.050385 seconds and 4 git commands to generate.