This thread should not be stuck in an active state when the application is shutting down.
Signed-off-by: Matthew Hall <mhall at mhcomputing.net> --- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 39 +++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index aa332a1..c999cb6 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -867,6 +867,7 @@ rte_eal_intr_init(void) { int ret = 0, ret_1 = 0; char thread_name[RTE_MAX_THREAD_NAME_LEN]; + pthread_attr_t thread_attr; /* init the global interrupt source head */ TAILQ_INIT(&intr_sources); @@ -878,20 +879,40 @@ rte_eal_intr_init(void) if (pipe(intr_pipe.pipefd) < 0) return -1; + ret = pthread_attr_init(&thread_attr); + if (ret != 0) { + RTE_LOG(ERR, EAL, + "Failed to init interrupt handling thread attributes\n"); + return -ret; + } + + ret = pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); + if (ret != 0) { + RTE_LOG(ERR, EAL, + "Failed to set interrupt handling thread attributes\n"); + return -ret; + } + /* create the host thread to wait/handle the interrupt */ - ret = pthread_create(&intr_thread, NULL, + ret = pthread_create(&intr_thread, &thread_attr, eal_intr_thread_main, NULL); if (ret != 0) { RTE_LOG(ERR, EAL, "Failed to create thread for interrupt handling\n"); - } else { - /* Set thread_name for aid in debugging. */ - snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, - "eal-intr-thread"); - ret_1 = rte_thread_setname(intr_thread, thread_name); - if (ret_1 != 0) - RTE_LOG(ERR, EAL, - "Failed to set thread name for interrupt handling\n"); + return -ret; + } + + /* Set thread_name for aid in debugging. */ + snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, + "eal-intr-thread"); + ret_1 = rte_thread_setname(intr_thread, thread_name); + if (ret_1 != 0) { + RTE_LOG(ERR, EAL, + "Failed to set thread name for interrupt handling\n"); + } + + return -ret; +} int rte_eal_intr_exit(void) -- 2.5.0