aboutsummaryrefslogtreecommitdiff
path: root/example/cli/odp_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/cli/odp_cli.c')
-rw-r--r--example/cli/odp_cli.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/example/cli/odp_cli.c b/example/cli/odp_cli.c
index 381fc8a59..bc5dad960 100644
--- a/example/cli/odp_cli.c
+++ b/example/cli/odp_cli.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2021 Nokia
+ * Copyright (c) 2021-2024 Nokia
*/
/**
@@ -101,7 +101,7 @@ static int cli_server(void *arg ODP_UNUSED)
/* Run CLI server. */
if (odph_cli_run()) {
ODPH_ERR("odph_cli_run() failed.\n");
- exit(EXIT_FAILURE);
+ return -1;
}
return 0;
@@ -178,6 +178,7 @@ int main(int argc, char *argv[])
odph_thread_common_param_t thr_common;
odph_thread_param_t thr_param;
odph_thread_t thr_server;
+ odph_thread_join_result_t res;
if (odp_cpumask_default_control(&cpumask, 1) != 1) {
ODPH_ERR("Failed to get default CPU mask.\n");
@@ -199,7 +200,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- printf("CLI server started on %s:%d\n", cli_param.address,
+ printf("CLI server started on %s:%d.\n", cli_param.address,
cli_param.port);
/* Wait for the given number of seconds. */
@@ -215,11 +216,17 @@ int main(int argc, char *argv[])
}
/* Wait for server thread to exit. */
- if (odph_thread_join(&thr_server, 1) != 1) {
+ if (odph_thread_join_result(&thr_server, &res, 1) != 1) {
ODPH_ERR("Failed to join server thread.\n");
exit(EXIT_FAILURE);
}
+ if (res.is_sig || res.ret != 0) {
+ ODPH_ERR("Worker thread failure%s: %d.\n", res.is_sig ? " (signaled)" : "",
+ res.ret);
+ exit(EXIT_FAILURE);
+ }
+
/* Terminate CLI helper. */
if (odph_cli_term()) {
ODPH_ERR("CLI helper termination failed.\n");