From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 5/6] eal: use rte thread API
Date: Fri, 17 Mar 2023 15:34:19 -0700 [thread overview]
Message-ID: <1679092460-9930-6-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1679092460-9930-1-git-send-email-roretzla@linux.microsoft.com>
Update driver to use rte thread API where available instead of pthread
as a prerequisite to removing pthread stubs on Windows.
There is a single pthread_create still in use until
rte_ctrl_thread_create is removed.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
lib/eal/common/eal_common_thread.c | 4 ++--
lib/eal/windows/eal.c | 2 +-
lib/eal/windows/eal_interrupts.c | 12 ++++++------
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/eal/common/eal_common_thread.c b/lib/eal/common/eal_common_thread.c
index 079a385..e3aad2c 100644
--- a/lib/eal/common/eal_common_thread.c
+++ b/lib/eal/common/eal_common_thread.c
@@ -176,7 +176,7 @@ unsigned rte_socket_id(void)
ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
- lcore_id, (uintptr_t)pthread_self(), cpuset,
+ lcore_id, rte_thread_self().opaque_id, cpuset,
ret == 0 ? "" : "...");
rte_eal_trace_thread_lcore_ready(lcore_id, cpuset);
@@ -330,7 +330,7 @@ static uint32_t control_thread_start(void *arg)
/* Check if the control thread encountered an error */
if (ctrl_thread_status == CTRL_THREAD_ERROR) {
/* ctrl thread is exiting */
- pthread_join(*thread, NULL);
+ rte_thread_join((rte_thread_t){(uintptr_t)*thread}, NULL);
}
ret = params->ret;
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index e7d405b..89da0c0 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -416,7 +416,7 @@ enum rte_proc_type_t
ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
- config->main_lcore, (uintptr_t)pthread_self(), cpuset,
+ config->main_lcore, rte_thread_self().opaque_id, cpuset,
ret == 0 ? "" : "...");
RTE_LCORE_FOREACH_WORKER(i) {
diff --git a/lib/eal/windows/eal_interrupts.c b/lib/eal/windows/eal_interrupts.c
index bb0585c..49c4b96 100644
--- a/lib/eal/windows/eal_interrupts.c
+++ b/lib/eal/windows/eal_interrupts.c
@@ -9,7 +9,7 @@
#define IOCP_KEY_SHUTDOWN UINT32_MAX
-static pthread_t intr_thread;
+static rte_thread_t intr_thread;
static HANDLE intr_iocp;
static HANDLE intr_thread_handle;
@@ -33,7 +33,7 @@
return 0;
}
-static void *
+static uint32_t
eal_intr_thread_main(LPVOID arg __rte_unused)
{
bool finished = false;
@@ -78,12 +78,12 @@
intr_thread_handle = NULL;
cleanup:
- intr_thread = 0;
+ intr_thread.opaque_id = 0;
CloseHandle(intr_iocp);
intr_iocp = NULL;
- return NULL;
+ return 0;
}
int
@@ -98,7 +98,7 @@
return -1;
}
- ret = rte_ctrl_thread_create(&intr_thread, "eal-intr-thread", NULL,
+ ret = rte_thread_create_control(&intr_thread, "eal-intr-thread", NULL,
eal_intr_thread_main, NULL);
if (ret != 0) {
rte_errno = -ret;
@@ -111,7 +111,7 @@
int
rte_thread_is_intr(void)
{
- return pthread_equal(intr_thread, pthread_self());
+ return rte_thread_equal(intr_thread, rte_thread_self());
}
int
--
1.8.3.1
next prev parent reply other threads:[~2023-03-17 22:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 22:34 [PATCH 0/6] windows: remove most pthread lifetime shim functions Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 1/6] dma/skeleton: use rte thread API Tyler Retzlaff
2023-04-18 9:19 ` Bruce Richardson
2023-04-18 15:04 ` Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 2/6] net/ixgbe: " Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 3/6] net/ice: " Tyler Retzlaff
2023-03-17 22:34 ` [PATCH 4/6] net/iavf: " Tyler Retzlaff
2023-03-17 22:34 ` Tyler Retzlaff [this message]
2023-03-17 22:34 ` [PATCH 6/6] windows: remove most pthread lifetime shim functions Tyler Retzlaff
2023-04-03 5:34 ` [PATCH 0/6] " Tyler Retzlaff
2023-04-18 9:21 ` Bruce Richardson
2023-06-01 8:49 ` David Marchand
2023-06-01 12:23 ` Zhang, Qi Z
2023-06-02 16:22 ` Tyler Retzlaff
2023-06-09 12:38 ` David Marchand
2023-04-17 16:46 ` Tyler Retzlaff
2023-06-09 12:39 ` David Marchand
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=1679092460-9930-6-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/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).