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 <roret...@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

Reply via email to