From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.mhcomputing.net (master.mhcomputing.net [74.208.228.170]) by dpdk.org (Postfix) with ESMTP id 9B5188D3B for ; Sat, 13 Feb 2016 22:38:51 +0100 (CET) Received: from mvs-01.mhcomputing.net (99-34-229-174.lightspeed.sntcca.sbcglobal.net [99.34.229.174]) by mail.mhcomputing.net (Postfix) with ESMTPSA id 8C5B6FC; Sat, 13 Feb 2016 13:38:50 -0800 (PST) From: Matthew Hall To: dev@dpdk.org Date: Sat, 13 Feb 2016 13:38:42 -0800 Message-Id: <1455399524-3252-1-git-send-email-mhall@mhcomputing.net> X-Mailer: git-send-email 2.5.0 Subject: [dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Feb 2016 21:38:51 -0000 There is no good way to shut down this thread from an application signal handler. Here we add an rte_eal_intr_exit() function to allow this. Signed-off-by: Matthew Hall --- lib/librte_eal/common/include/rte_eal.h | 9 +++++++++ lib/librte_eal/linuxapp/eal/eal_interrupts.c | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index d2816a8..1533eeb 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -165,6 +165,15 @@ int rte_eal_init(int argc, char **argv); typedef void (*rte_usage_hook_t)(const char * prgname); /** + * Shut down the EAL interrupt thread. + * + * This function can be called from a signal handler during application + * shutdown. + * + */ +int rte_eal_intr_exit(void); + +/** * Add application usage routine callout from the eal_usage() routine. * * This function allows the application to include its usage message diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index b33ccdb..aa332a1 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -892,6 +892,17 @@ rte_eal_intr_init(void) if (ret_1 != 0) RTE_LOG(ERR, EAL, "Failed to set thread name for interrupt handling\n"); + +int +rte_eal_intr_exit(void) +{ + int ret = 0; + + ret = pthread_cancel(intr_thread); + if (ret != 0) { + RTE_LOG(ERR, EAL, + "Failed to cancel thread for interrupt handling\n"); + return -ret; } return -ret; -- 2.5.0