From: Matthew Hall <mhall@mhcomputing.net>
To: dev@dpdk.org
Subject: [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread
Date: Sat, 13 Feb 2016 13:38:42 -0800 [thread overview]
Message-ID: <1455399524-3252-1-git-send-email-mhall@mhcomputing.net> (raw)
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 <mhall@mhcomputing.net>
---
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
next 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 Matthew Hall [this message]
2016-02-13 21:38 ` [PATCH 2/3] eal_interrupts: mark EAL interrupt thread as a daemon thread Matthew Hall
2016-02-13 21:38 ` [PATCH 3/3] rte_epoll_wait: allow EINTR to be passed to caller Matthew Hall
2016-02-28 21:17 ` [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, " 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-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.