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
|
#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
|
||||||
|
|
Loading…
Reference in New Issue