eal/windows: support thread ID query

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

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation 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/iol-testing fail Testing issues

Commit Message

Tasnim Bashar May 18, 2020, 2:26 p.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>
---
 lib/librte_eal/windows/eal_thread.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Dmitry Kozlyuk May 18, 2020, 5:48 p.m. UTC | #1
On Mon, 18 May 2020 17:26:34 +0300
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>
> ---
>  lib/librte_eal/windows/eal_thread.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/lib/librte_eal/windows/eal_thread.c
> 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
> @@ -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.

> +{
> +	return (int)eal_thread_self();

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

> +}
> +
>  int
>  rte_thread_setname(__rte_unused pthread_t id, __rte_unused const
> char *name) {

--
Dmitry Kozlyuk
  

Patch

diff --git a/lib/librte_eal/windows/eal_thread.c 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
@@ -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)
 {