Commit 431fb423 authored by Gabi Melman's avatar Gabi Melman Committed by GitHub

Merge pull request #463 from sheldonlyr/threadid-osx

More meaningful thread id for OSX
parents 1e4f14c7 66a2c499
...@@ -330,7 +330,11 @@ inline size_t _thread_id() ...@@ -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
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment