We can use the global interrupter's state instead, and we don't need to
check the interruption status before calling bt_query_executor_query()
and bt_graph_run() as both functions check their interruption state
initially.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3818843c44b016cf2b872d879b461eae52730e6b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1758
Tested-by: jenkins <jenkins@lttng.org>
/* Application's interrupter (owned by this) */
static bt_interrupter *the_interrupter;
/* Application's interrupter (owned by this) */
static bt_interrupter *the_interrupter;
-static volatile bool interrupted = false;
bt_interrupter_set(the_interrupter);
}
bt_interrupter_set(the_interrupter);
}
if (the_interrupter) {
bt_interrupter_set(the_interrupter);
}
if (the_interrupter) {
bt_interrupter_set(the_interrupter);
}
bt_query_executor_add_interrupter(query_exec, the_interrupter);
bt_query_executor_add_interrupter(query_exec, the_interrupter);
- if (interrupted) {
- BT_CLI_LOGW_APPEND_CAUSE(
- "Interrupted by user before executing the query: "
- "comp-cls-addr=%p, comp-cls-name=\"%s\", "
- "query-obj=\"%s\"", comp_cls,
- bt_component_class_get_name(comp_cls), obj);
- *fail_reason = "interrupted by user";
- goto error;
- }
-
while (true) {
query_status = bt_query_executor_query(
query_exec, comp_cls, obj, params,
while (true) {
query_status = bt_query_executor_query(
query_exec, comp_cls, obj, params,
+ if (bt_interrupter_is_set(the_interrupter)) {
BT_CLI_LOGW_APPEND_CAUSE(
"Interrupted by user before creating components.");
goto error;
BT_CLI_LOGW_APPEND_CAUSE(
"Interrupted by user before creating components.");
goto error;
+ if (bt_interrupter_is_set(the_interrupter)) {
BT_CLI_LOGW_APPEND_CAUSE(
"Interrupted by user before connecting components.");
goto error;
BT_CLI_LOGW_APPEND_CAUSE(
"Interrupted by user before connecting components.");
goto error;
- if (interrupted) {
- BT_CLI_LOGW_APPEND_CAUSE(
- "Interrupted by user before running the graph.");
- goto error;
- }
-
BT_LOGI_STR("Running the graph.");
/* Run the graph */
BT_LOGI_STR("Running the graph.");
/* Run the graph */