Skip to contentSkip to conversation

eal/windows: support thread ID query

PATCH Superseded Tasnim Bashar 2 participants 2 messages May 18, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal/windows: support thread ID query

Add rte_sys_gettid function to use rte_gettid() on Windows. rte_gettid() is required for recursive spin lock and recursive ticket lock.

---
 lib/librte_eal/windows/eal_thread.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/librte_eal/windows/eal_thread.c +6 -0
index e149199a6f..18f03c4280 100644
@@ -157,6 +157,12 @@ eal_thread_create(pthread_t *thread)
 	return 0;
 }
 
+/* get current thread ID */
+int rte_sys_gettid(void)
+{
+	return (int)eal_thread_self();
+}
+
 int
 rte_thread_setname(__rte_unused pthread_t id, __rte_unused const char *name)
 {
Signature · 1 line
2.16.1.windows.4
#1 lore raw
Quoted 14 lines · On Mon, 18 May 2020 17:26:34 +0300 Tasnim Bashar <[email protected]> wrote:

Add rte_sys_gettid function to use rte_gettid() on Windows. rte_gettid() is required for recursive spin lock and recursive ticket lock.

---
 lib/librte_eal/windows/eal_thread.c | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/lib/librte_eal/windows/eal_thread.c index e149199a6f..18f03c4280 100644 --- a/lib/librte_eal/windows/eal_thread.c
+++ b/lib/librte_eal/windows/eal_thread.c

lib/librte_eal/windows/eal_thread.c eal_thread_create(pthread_t *thread) · line 161

Quoted 5 lines
lib/librte_eal/windows/eal_thread.c +2 -0
@@ -157,6 +157,12 @@ eal_thread_create(pthread_t *thread)
 	return 0;
 }
 
+/* get current thread ID */
+int rte_sys_gettid(void)

Please follow the style guide and place return type on a separate line. You can use ./devtools/checkpatches.sh to catch similar mistakes.

lib/librte_eal/windows/eal_thread.c eal_thread_create(pthread_t *thread) · line 163

Quoted 2 lines
lib/librte_eal/windows/eal_thread.c +2 -0
+{
+	return (int)eal_thread_self();

Maybe get rid of eal_thread_self() in this file and replace its call with rte_sys_gettid()?

lib/librte_eal/windows/eal_thread.c eal_thread_create(pthread_t *thread)

Quoted 5 lines
lib/librte_eal/windows/eal_thread.c +2 -0
+}
+
 int
 rte_thread_setname(__rte_unused pthread_t id, __rte_unused const
 char *name) {

--
Dmitry Kozlyuk