ntdll: Prefer a portable function to get thread id.

This commit is contained in:
Jan Beich 2012-08-16 19:04:51 +00:00 committed by Alexandre Julliard
parent 20e1b46d83
commit fa4e97f454
4 changed files with 11 additions and 1 deletions

1
configure vendored
View File

@ -10611,6 +10611,7 @@ LIBS="$LIBS $LIBPTHREAD"
for ac_func in \ for ac_func in \
pthread_attr_get_np \ pthread_attr_get_np \
pthread_getattr_np \ pthread_getattr_np \
pthread_getthreadid_np \
pthread_get_stackaddr_np \ pthread_get_stackaddr_np \
pthread_get_stacksize_np pthread_get_stacksize_np
do : do :

View File

@ -1471,6 +1471,7 @@ dnl **** Check for pthread functions ****
WINE_CHECK_LIB_FUNCS(\ WINE_CHECK_LIB_FUNCS(\
pthread_attr_get_np \ pthread_attr_get_np \
pthread_getattr_np \ pthread_getattr_np \
pthread_getthreadid_np \
pthread_get_stackaddr_np \ pthread_get_stackaddr_np \
pthread_get_stacksize_np, pthread_get_stacksize_np,
[$LIBPTHREAD]) [$LIBPTHREAD])

View File

@ -28,6 +28,9 @@
#endif #endif
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_PTHREAD_NP_H
# include <pthread_np.h>
#endif
#include <signal.h> #include <signal.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -944,7 +947,9 @@ static void send_server_task_port(void)
static int get_unix_tid(void) static int get_unix_tid(void)
{ {
int ret = -1; int ret = -1;
#ifdef linux #ifdef HAVE_PTHREAD_GETTHREADID_NP
ret = pthread_getthreadid_np();
#elif defined(linux)
ret = syscall( SYS_gettid ); ret = syscall( SYS_gettid );
#elif defined(__sun) #elif defined(__sun)
ret = pthread_self(); ret = pthread_self();

View File

@ -632,6 +632,9 @@
/* Define to 1 if you have the `pthread_getattr_np' function. */ /* Define to 1 if you have the `pthread_getattr_np' function. */
#undef HAVE_PTHREAD_GETATTR_NP #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. */ /* Define to 1 if you have the `pthread_get_stackaddr_np' function. */
#undef HAVE_PTHREAD_GET_STACKADDR_NP #undef HAVE_PTHREAD_GET_STACKADDR_NP