Commit | Line | Data |
---|---|---|
287a512f | 1 | /* |
ab5be9fa MJ |
2 | * Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
3 | * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
287a512f | 4 | * |
ab5be9fa | 5 | * SPDX-License-Identifier: LGPL-2.1-only |
287a512f JG |
6 | * |
7 | * This code is originally adapted from userspace-rcu's urcu-wait.h | |
8 | */ | |
9 | ||
10 | #ifndef LTTNG_WAITER_H | |
11 | #define LTTNG_WAITER_H | |
12 | ||
13 | #define _LGPL_SOURCE | |
14 | ||
15 | #include <stdint.h> | |
16 | #include <urcu/wfstack.h> | |
17 | #include <stdbool.h> | |
18 | #include "macros.h" | |
19 | ||
7966af57 SM |
20 | #ifdef __cplusplus |
21 | extern "C" { | |
22 | #endif | |
23 | ||
287a512f JG |
24 | struct lttng_waiter { |
25 | struct cds_wfs_node wait_queue_node; | |
26 | int32_t state; | |
27 | }; | |
28 | ||
287a512f JG |
29 | void lttng_waiter_init(struct lttng_waiter *waiter); |
30 | ||
287a512f JG |
31 | void lttng_waiter_wait(struct lttng_waiter *waiter); |
32 | ||
33 | /* | |
34 | * lttng_waiter_wake_up must only be called by a single waker. | |
35 | * It is invalid for multiple "wake" operations to be invoked | |
36 | * on a single waiter without re-initializing it before. | |
37 | */ | |
287a512f JG |
38 | void lttng_waiter_wake_up(struct lttng_waiter *waiter); |
39 | ||
7966af57 SM |
40 | #ifdef __cplusplus |
41 | } | |
42 | #endif | |
43 | ||
287a512f | 44 | #endif /* LTTNG_WAITER_H */ |