[Common] gettid() not declared in this scope

This commit is contained in:
2016-04-28 18:27:35 -04:00
parent 73001a6001
commit 433e5c7d9b
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