Commit | Line | Data |
---|---|---|
b70d57a1 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
b70d57a1 | 3 | * |
0235b0db | 4 | * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com> |
b70d57a1 PP |
5 | */ |
6 | ||
ae2be88d SM |
7 | #ifndef BABELTRACE_LIB_GRAPH_INTERRUPTER_H |
8 | #define BABELTRACE_LIB_GRAPH_INTERRUPTER_H | |
0235b0db | 9 | |
c4f23e30 FD |
10 | #include <stdbool.h> |
11 | ||
b70d57a1 PP |
12 | #include <glib.h> |
13 | #include <babeltrace2/babeltrace.h> | |
14 | ||
15 | #include "lib/object.h" | |
16 | ||
17 | struct bt_interrupter { | |
18 | struct bt_object base; | |
19 | bool is_set; | |
20 | }; | |
21 | ||
9b4f9b42 PP |
22 | static inline |
23 | bool bt_interrupter_array_any_is_set(const GPtrArray *interrupters) | |
24 | { | |
25 | bool is_set = false; | |
26 | uint64_t i; | |
27 | ||
98b15851 | 28 | BT_ASSERT_DBG(interrupters); |
9b4f9b42 PP |
29 | |
30 | for (i = 0; i < interrupters->len; i++) { | |
31 | const struct bt_interrupter *intr = interrupters->pdata[i]; | |
32 | ||
33 | if (intr->is_set) { | |
34 | is_set = true; | |
35 | goto end; | |
36 | } | |
37 | } | |
38 | ||
39 | end: | |
40 | return is_set; | |
41 | } | |
42 | ||
ae2be88d | 43 | #endif /* BABELTRACE_LIB_GRAPH_INTERRUPTER_H */ |