Merge pull request #463 from sheldonlyr/threadid-osx
More meaningful thread id for OSX
This commit is contained in:
commit
431fb423fa
@ -330,7 +330,11 @@ inline size_t _thread_id()
|
|||||||
long tid;
|
long tid;
|
||||||
thr_self(&tid);
|
thr_self(&tid);
|
||||||
return static_cast<size_t>(tid);
|
return static_cast<size_t>(tid);
|
||||||
#else //Default to standard C++11 (OSX and other Unix)
|
#elif __APPLE__
|
||||||
|
uint64_t tid;
|
||||||
|
pthread_threadid_np(nullptr, &tid);
|
||||||
|
return static_cast<size_t>(tid);
|
||||||
|
#else //Default to standard C++11 (other Unix)
|
||||||
return static_cast<size_t>(std::hash<std::thread::id>()(std::this_thread::get_id()));
|
return static_cast<size_t>(std::hash<std::thread::id>()(std::this_thread::get_id()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user