Remove runtime dependency on liburcu shared objects
[lttng-ust.git] / include / lttng / urcu / urcu-ust.h
CommitLineData
10544ee8
MD
1#ifndef _LTTNG_UST_URCU_H
2#define _LTTNG_UST_URCU_H
3
4/*
5 * urcu-ust.h
6 *
7 * Userspace RCU header for LTTng-UST. Derived from liburcu
8 * "bulletproof" flavor.
9 *
10 * Slower RCU read-side adapted for tracing library. Does not require thread
11 * registration nor unregistration. Also signal-safe.
12 *
13 * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
14 * Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
15 *
16 * LGPL-compatible code should include this header with :
17 *
18 * #define _LGPL_SOURCE
19 * #include <lttng/urcu-ust.h>
20 *
21 * This library is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU Lesser General Public
23 * License as published by the Free Software Foundation; either
24 * version 2.1 of the License, or (at your option) any later version.
25 *
26 * This library is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
30 *
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
34 *
35 * IBM's contributions to this file may be relicensed under LGPLv2 or later.
36 */
37
38#include <stdlib.h>
39#include <pthread.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45/*
46 * See lttng/urcu/pointer.h and lttng/urcu/static/pointer.h for pointer
47 * publication headers.
48 */
49#include <lttng/urcu/pointer.h>
50
51#ifdef _LGPL_SOURCE
52
53#include <lttng/urcu/static/urcu-ust.h>
54
55/*
56 * Mappings for static use of the userspace RCU library.
57 * Should only be used in LGPL-compatible code.
58 */
59
60/*
61 * lttng_ust_urcu_read_lock()
62 * lttng_ust_urcu_read_unlock()
63 *
64 * Mark the beginning and end of a read-side critical section.
65 */
66#define lttng_ust_urcu_read_lock _lttng_ust_urcu_read_lock
67#define lttng_ust_urcu_read_unlock _lttng_ust_urcu_read_unlock
68#define lttng_ust_urcu_read_ongoing _lttng_ust_urcu_read_ongoing
69
70#else /* !_LGPL_SOURCE */
71
72/*
73 * library wrappers to be used by non-LGPL compatible source code.
74 * See LGPL-only urcu/static/pointer.h for documentation.
75 */
76
77extern void lttng_ust_urcu_read_lock(void);
78extern void lttng_ust_urcu_read_unlock(void);
79extern int lttng_ust_urcu_read_ongoing(void);
80
81#endif /* !_LGPL_SOURCE */
82
83extern void lttng_ust_urcu_synchronize_rcu(void);
84
85/*
86 * lttng_ust_urcu_before_fork, lttng_ust_urcu_after_fork_parent and
87 * lttng_ust_urcu_after_fork_child should be called around fork() system
88 * calls when the child process is not expected to immediately perform
89 * an exec(). For pthread users, see pthread_atfork(3).
90 */
91extern void lttng_ust_urcu_before_fork(void);
92extern void lttng_ust_urcu_after_fork_parent(void);
93extern void lttng_ust_urcu_after_fork_child(void);
94
95/*
96 * In the UST version, thread registration is performed lazily, but it can be
97 * forced by issuing an explicit lttng_ust_urcu_register_thread().
98 */
99extern void lttng_ust_urcu_register_thread(void);
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif /* _LTTNG_UST_URCU_H */
This page took 0.025645 seconds and 4 git commands to generate.