From: Matthew Hall <mhall@mhcomputing.net>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/3] eal_interrupts: mark EAL interrupt thread as a daemon thread
Date: Sat, 13 Feb 2016 13:38:43 -0800 [thread overview]
Message-ID: <1455399524-3252-2-git-send-email-mhall@mhcomputing.net> (raw)
In-Reply-To: <1455399524-3252-1-git-send-email-mhall@mhcomputing.net>
This thread should not be stuck in an active state when the application is
shutting down.
Signed-off-by: Matthew Hall <mhall@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
next prev parent reply other threads:[~2016-02-13 21:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-13 21:38 [dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread Matthew Hall
2016-02-13 21:38 ` Matthew Hall [this message]
2016-02-13 21:38 ` [dpdk-dev] [PATCH 3/3] rte_epoll_wait: allow EINTR to be passed to caller Matthew Hall
2016-02-28 21:17 ` [dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread Thomas Monjalon
2016-03-08 15:09 ` Thomas Monjalon
2016-03-09 9:05 ` Liang, Cunming
2016-03-17 22:55 ` [dpdk-dev] [dpdk-dev, " Matthew Hall
2016-03-21 7:58 ` Liang, Cunming
2016-03-22 7:39 ` Matthew Hall
2016-03-23 3:24 ` Liang, Cunming
2016-07-08 17:36 ` Thomas Monjalon
2016-07-11 4:07 ` Liang, Cunming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455399524-3252-2-git-send-email-mhall@mhcomputing.net \
--to=mhall@mhcomputing.net \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).