[v2] eal/windows: support thread ID query

Message ID 20200521003253.75212-1-tbashar@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] eal/windows: support thread ID query |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing fail Testing issues
ci/travis-robot success Travis build: passed

Commit Message

Tasnim Bashar May 21, 2020, 12:32 a.m. UTC
  Add rte_sys_gettid function to use rte_gettid() on Windows.
rte_gettid() is required for recursive spin lock and recursive ticket lock.

Signed-off-by: Tasnim Bashar <tbashar@mellanox.com>
---

v2: remove eal_thread_self function and fix style

---
 lib/librte_eal/windows/eal_thread.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
  

Comments

Dmitry Kozlyuk May 25, 2020, 1:08 a.m. UTC | #1
On Wed, 20 May 2020 17:32:53 -0700
Tasnim Bashar <tbashar@mellanox.com> wrote:

> Add rte_sys_gettid function to use rte_gettid() on Windows.
> rte_gettid() is required for recursive spin lock and recursive ticket lock.
> 
> Signed-off-by: Tasnim Bashar <tbashar@mellanox.com>
> ---
> 
> v2: remove eal_thread_self function and fix style
> 
> ---
>  lib/librte_eal/windows/eal_thread.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
[snip]

Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
  
Thomas Monjalon June 11, 2020, 2:41 p.m. UTC | #2
25/05/2020 03:08, Dmitry Kozlyuk:
> On Wed, 20 May 2020 17:32:53 -0700
> Tasnim Bashar <tbashar@mellanox.com> wrote:
> 
> > Add rte_sys_gettid function to use rte_gettid() on Windows.
> > rte_gettid() is required for recursive spin lock and recursive ticket lock.
> > 
> > Signed-off-by: Tasnim Bashar <tbashar@mellanox.com>
> 
> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c
index e149199a6f..4c1e31c58a 100644
--- a/lib/librte_eal/windows/eal_thread.c
+++ b/lib/librte_eal/windows/eal_thread.c
@@ -64,12 +64,6 @@  eal_thread_init_master(unsigned int lcore_id)
 	RTE_PER_LCORE(_lcore_id) = lcore_id;
 }
 
-static inline pthread_t
-eal_thread_self(void)
-{
-	return GetCurrentThreadId();
-}
-
 /* main loop of threads */
 void *
 eal_thread_loop(void *arg __rte_unused)
@@ -81,7 +75,7 @@  eal_thread_loop(void *arg __rte_unused)
 	int m2s, s2m;
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 
-	thread_id = eal_thread_self();
+	thread_id = pthread_self();
 
 	/* retrieve our lcore_id from the configuration structure */
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
@@ -157,6 +151,13 @@  eal_thread_create(pthread_t *thread)
 	return 0;
 }
 
+/* get current thread ID */
+int
+rte_sys_gettid(void)
+{
+	return GetCurrentThreadId();
+}
+
 int
 rte_thread_setname(__rte_unused pthread_t id, __rte_unused const char *name)
 {