summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPiotr Azarewicz <piotrx.t.azarewicz@intel.com>2016-06-29 15:15:38 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-07-11 17:21:21 +0200
commit3ca530edd4443f217beefe36fd176ce2804e0bf7 (patch)
tree853477ef49d488d0307c70bf641881703791f2a3 /examples
parent8a499c23feaa3174e1c35276481ff1094508bec3 (diff)
downloaddpdk-3ca530edd4443f217beefe36fd176ce2804e0bf7.zip
dpdk-3ca530edd4443f217beefe36fd176ce2804e0bf7.tar.gz
dpdk-3ca530edd4443f217beefe36fd176ce2804e0bf7.tar.xz
examples/bond: check thread termination
The example is calling rte_eal_wait_lcore without checking return value. Now it is fixed by checking the value and print proper message. Coverity issue: 37789, 37790 Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6") Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com> Acked-by: Declan Doherty <declan.doherty@intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/bond/main.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 53bd044..776fad0 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -590,10 +590,14 @@ static void cmd_stop_parsed(__attribute__((unused)) void *parsed_result,
return;
}
global_flag_stru_p->LcoreMainIsRunning = 0;
- rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore);
- cmdline_printf(cl,
- "lcore_main stopped on core:%d\n",
- global_flag_stru_p->LcoreMainCore);
+ if (rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore) < 0)
+ cmdline_printf(cl,
+ "error: lcore_main can not stop on core:%d\n",
+ global_flag_stru_p->LcoreMainCore);
+ else
+ cmdline_printf(cl,
+ "lcore_main stopped on core:%d\n",
+ global_flag_stru_p->LcoreMainCore);
rte_spinlock_unlock(&global_flag_stru_p->lock);
}
@@ -628,10 +632,14 @@ static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,
return;
}
global_flag_stru_p->LcoreMainIsRunning = 0;
- rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore);
- cmdline_printf(cl,
- "lcore_main stopped on core:%d\n",
- global_flag_stru_p->LcoreMainCore);
+ if (rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore) < 0)
+ cmdline_printf(cl,
+ "error: lcore_main can not stop on core:%d\n",
+ global_flag_stru_p->LcoreMainCore);
+ else
+ cmdline_printf(cl,
+ "lcore_main stopped on core:%d\n",
+ global_flag_stru_p->LcoreMainCore);
rte_spinlock_unlock(&global_flag_stru_p->lock);
cmdline_quit(cl);
}