Merge pull request #1073 from cxd4/undefined-gettid

[Common] gettid() not declared in this scope
This commit is contained in:
zilmar 2016-04-29 09:02:58 +10:00
commit edced1f6e6
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#ifndef _WIN32 #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#include <pthread.h> #include <pthread.h>
#include <sys/syscall.h>
#endif #endif
CThread::CThread(CTHREAD_START_ROUTINE lpStartAddress) : CThread::CThread(CTHREAD_START_ROUTINE lpStartAddress) :
@ -125,6 +126,8 @@ uint32_t CThread::GetCurrentThreadId(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
return ::GetCurrentThreadId(); return ::GetCurrentThreadId();
#elif defined(SYS_gettid) || defined(__NR_gettid)
return syscall(__NR_gettid); /* GLIBC has no implementation of gettid(). */
#else #else
return gettid(); return gettid();
#endif #endif