When rte_eal_cleanup is called it should stop all the child threads
and close the pipes between threads.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
Acked-by: Aaron Conole <acon...@redhat.com>
---
 lib/librte_eal/linux/eal.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index 7458592f4950..27b768b15c4a 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -1327,11 +1327,24 @@ mark_freeable(const struct rte_memseg_list *msl, const 
struct rte_memseg *ms,
 int
 rte_eal_cleanup(void)
 {
+       int i;
+
        /* if we're in a primary process, we need to mark hugepages as freeable
         * so that finalization can release them back to the system.
         */
        if (rte_eal_process_type() == RTE_PROC_PRIMARY)
                rte_memseg_walk(mark_freeable, NULL);
+
+       RTE_LCORE_FOREACH_SLAVE(i) {
+               pthread_cancel(lcore_config[i].thread_id);
+               pthread_join(lcore_config[i].thread_id, NULL);
+
+               close(lcore_config[i].pipe_master2slave[0]);
+               close(lcore_config[i].pipe_master2slave[1]);
+               close(lcore_config[i].pipe_slave2master[0]);
+               close(lcore_config[i].pipe_slave2master[1]);
+       }
+
        rte_service_finalize();
        rte_eal_alarm_cleanup();
        rte_mp_channel_cleanup();
-- 
2.20.1

Reply via email to