eal/windows: support thread ID query
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
@@ -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
Quoted 14 lines · On Mon, 18 May 2020 17:26:34 +0300 Tasnim Bashar <[email protected]> wrote:
Add
rte_sys_gettidfunction to userte_gettid()on Windows.rte_gettid()is required for recursive spin lock and recursive ticket lock.Signed-off-by Tasnim Bashar <[email protected]>--- lib/librte_eal/windows/eal_thread.c | 6 ++++++ 1 file changed, 6 insertions(+)(quoted diff) +0
-0
b/lib/librte_eal/windows/eal_thread.cindexe149199a6f..18f03c4280100644 ---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