fix gettid on MacOS

This commit is contained in:
Vítor Santos Costa 2015-10-05 10:30:17 +01:00
parent 544eeea97f
commit 9a962805ca

View File

@ -33,6 +33,9 @@ static char SccsId[] = "%W% %G%";
#if HAVE_STRING_H #if HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#if HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
#ifdef TABLING #ifdef TABLING
#include "tab.macros.h" #include "tab.macros.h"
#endif /* TABLING */ #endif /* TABLING */
@ -1562,13 +1565,16 @@ p_thread_unlock( USES_REGS1 )
intptr_t intptr_t
system_thread_id(void) system_thread_id(void)
{ {
#ifdef HAVE_GETTID_SYSCALL #if HAVE_SYS_GETTID
Return syscall( SYS_GETTID );
#elif HAVE_GETTID_SYSCALL
return syscall(__NR_gettid); return syscall(__NR_gettid);
#elif defined( HAVE_GETTID_MACRO ) #elif defined( HAVE_GETTID_MACRO )
return gettid(); return gettid();
#elif defined(__WINDOWS__) #elif defined(__WINDOWS__)
return GetCurrentThreadId(); return GetCurrentThreadId();
#endif #endif
} }