mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-16 00:45:48 +08:00
More meaningful thread id for OSX
This commit is contained in:
parent
1e4f14c789
commit
66a2c4993b
@ -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