5e48e5e69e4392bbe51351439437066c3224b216
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);
43 BT_ASSERT_PRE_NO_ERROR();
46 BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one interrupter.");
50 bt_object_init_shared(&intr
->base
, destroy_interrupter
);
54 BT_OBJECT_PUT_REF_AND_RESET(intr
);
60 void bt_interrupter_set(struct bt_interrupter
*intr
)
62 BT_ASSERT_PRE_NON_NULL(intr
, "Interrupter");
66 void bt_interrupter_reset(struct bt_interrupter
*intr
)
68 BT_ASSERT_PRE_NON_NULL(intr
, "Interrupter");
72 bt_bool
bt_interrupter_is_set(const struct bt_interrupter
*intr
)
74 BT_ASSERT_PRE_NON_NULL(intr
, "Interrupter");
75 return (bt_bool
) intr
->is_set
;
78 void bt_interrupter_get_ref(const struct bt_interrupter
*intr
)
80 bt_object_get_ref(intr
);
83 void bt_interrupter_put_ref(const struct bt_interrupter
*intr
)
85 bt_object_put_ref(intr
);
This page took 0.031633 seconds and 3 git commands to generate.