From fa4e97f4547d7478f42cf5702cca1da85fd76b74 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Thu, 16 Aug 2012 19:04:51 +0000 Subject: [PATCH] ntdll: Prefer a portable function to get thread id. --- configure | 1 + configure.ac | 1 + dlls/ntdll/server.c | 7 ++++++- include/config.h.in | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 86c969814d4..12c99e8154d 100755 --- a/configure +++ b/configure @@ -10611,6 +10611,7 @@ LIBS="$LIBS $LIBPTHREAD" for ac_func in \ pthread_attr_get_np \ pthread_getattr_np \ + pthread_getthreadid_np \ pthread_get_stackaddr_np \ pthread_get_stacksize_np do : diff --git a/configure.ac b/configure.ac index c80fd8adbab..c9e81fe1a35 100644 --- a/configure.ac +++ b/configure.ac @@ -1471,6 +1471,7 @@ dnl **** Check for pthread functions **** WINE_CHECK_LIB_FUNCS(\ pthread_attr_get_np \ pthread_getattr_np \ + pthread_getthreadid_np \ pthread_get_stackaddr_np \ pthread_get_stacksize_np, [$LIBPTHREAD]) diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c index 392668d5f19..cc49bad31cd 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -28,6 +28,9 @@ #endif #include #include +#ifdef HAVE_PTHREAD_NP_H +# include +#endif #include #include #include @@ -944,7 +947,9 @@ static void send_server_task_port(void) static int get_unix_tid(void) { int ret = -1; -#ifdef linux +#ifdef HAVE_PTHREAD_GETTHREADID_NP + ret = pthread_getthreadid_np(); +#elif defined(linux) ret = syscall( SYS_gettid ); #elif defined(__sun) ret = pthread_self(); diff --git a/include/config.h.in b/include/config.h.in index 844600c5d9f..e9416a43601 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -632,6 +632,9 @@ /* Define to 1 if you have the `pthread_getattr_np' function. */ #undef HAVE_PTHREAD_GETATTR_NP +/* Define to 1 if you have the `pthread_getthreadid_np' function. */ +#undef HAVE_PTHREAD_GETTHREADID_NP + /* Define to 1 if you have the `pthread_get_stackaddr_np' function. */ #undef HAVE_PTHREAD_GET_STACKADDR_NP -- 2.11.4.GIT