add apple-specific way of getting the thread id

This commit is contained in:
Isaac Connor 2017-06-14 10:57:40 -04:00
parent b59e870fd4
commit fe8b0105d2
1 changed files with 4 additions and 0 deletions

View File

@ -43,6 +43,10 @@ private:
#else
#ifdef __FreeBSD_kernel__
if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id
#elif defined(__APPLE__) && defined(__MACH__)
uint64_t tid64;
pthread_threadid_np(NULL, &tid64);
tid = (pid_t)tid64;
#else
tid=syscall(SYS_gettid);
#endif