From patchwork Sat Feb 13 21:38:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Hall X-Patchwork-Id: 10496 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 2A18495DE; Sat, 13 Feb 2016 22:38:55 +0100 (CET) Received: from mail.mhcomputing.net (master.mhcomputing.net [74.208.228.170]) by dpdk.org (Postfix) with ESMTP id ECC678D3B 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 214CA772; Sat, 13 Feb 2016 13:38:51 -0800 (PST) From: Matthew Hall To: dev@dpdk.org Date: Sat, 13 Feb 2016 13:38:43 -0800 Message-Id: <1455399524-3252-2-git-send-email-mhall@mhcomputing.net> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455399524-3252-1-git-send-email-mhall@mhcomputing.net> References: <1455399524-3252-1-git-send-email-mhall@mhcomputing.net> Subject: [dpdk-dev] [PATCH 2/3] eal_interrupts: mark EAL interrupt thread as a daemon 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This thread should not be stuck in an active state when the application is shutting down. Signed-off-by: Matthew Hall --- 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)