Module: wine Branch: master Commit: fa4e97f4547d7478f42cf5702cca1da85fd76b74 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fa4e97f4547d7478f42cf5702c...
Author: Jan Beich jbeich@tormail.org Date: Thu Aug 16 19:04:51 2012 +0000
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 deletions(-)
diff --git a/configure b/configure index 86c9698..12c99e8 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 c80fd8a..c9e81fe 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 392668d..cc49bad 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -28,6 +28,9 @@ #endif #include <errno.h> #include <fcntl.h> +#ifdef HAVE_PTHREAD_NP_H +# include <pthread_np.h> +#endif #include <signal.h> #include <stdarg.h> #include <stdio.h> @@ -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 844600c..e9416a4 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