2 * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #define BT_LOG_TAG "LIB/INTERRUPTER"
24 #include "lib/logging.h"
28 #include <babeltrace2/babeltrace.h>
30 #include "interrupter.h"
31 #include "lib/assert-pre.h"
34 void destroy_interrupter(struct bt_object
*obj
)
39 extern struct bt_interrupter
*bt_interrupter_create(void)
41 struct bt_interrupter
*intr
= g_new0(struct bt_interrupter
, 1);
44 BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one interrupter.");
48 bt_object_init_shared(&intr
->base
, destroy_interrupter
);
52 BT_OBJECT_PUT_REF_AND_RESET(intr
);
58 void bt_interrupter_set(struct bt_interrupter
*intr
)
60 BT_ASSERT_PRE_NON_NULL(intr
, "Interrupter");
64 void bt_interrupter_reset(struct bt_interrupter
*intr
)
66 BT_ASSERT_PRE_NON_NULL(intr
, "Interrupter");
70 bt_bool
bt_interrupter_is_set(const struct bt_interrupter
*intr
)
72 BT_ASSERT_PRE_NON_NULL(intr
, "Interrupter");
73 return (bt_bool
) intr
->is_set
;
76 void bt_interrupter_get_ref(const struct bt_interrupter
*intr
)
78 bt_object_get_ref(intr
);
81 void bt_interrupter_put_ref(const struct bt_interrupter
*intr
)
83 bt_object_put_ref(intr
);
This page took 0.031395 seconds and 4 git commands to generate.