mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-27 08:41:02 +08:00
Thread local for get current thread id
This commit is contained in:
parent
99fa9ffc5d
commit
fb3837316c
@ -38,7 +38,8 @@ inline uint32_t getCurrentThreadId()
|
||||
#ifdef WIN32
|
||||
return (uint32_t)::GetCurrentThreadId();
|
||||
#else
|
||||
return (uint32_t)std::hash<std::thread::id>()(std::this_thread::get_id());
|
||||
thread_local static uint32_t _id = (uint32_t)std::hash<std::thread::id>()(std::this_thread::get_id());
|
||||
return _id;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user