Merge pull request #1073 from cxd4/undefined-gettid
[Common] gettid() not declared in this scope
This commit is contained in:
commit
edced1f6e6
|
@ -3,6 +3,7 @@
|
|||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
CThread::CThread(CTHREAD_START_ROUTINE lpStartAddress) :
|
||||
|
@ -125,6 +126,8 @@ uint32_t CThread::GetCurrentThreadId(void)
|
|||
{
|
||||
#ifdef _WIN32
|
||||
return ::GetCurrentThreadId();
|
||||
#elif defined(SYS_gettid) || defined(__NR_gettid)
|
||||
return syscall(__NR_gettid); /* GLIBC has no implementation of gettid(). */
|
||||
#else
|
||||
return gettid();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue