Commit 4292d3d9 authored by gabime's avatar gabime

Use gettid() syscall under linux to get thread id

parent a0910792
......@@ -32,6 +32,9 @@
# define WIN32_LEAN_AND_MEAN
# endif
# include <Windows.h>
#elif __linux__
#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
#include <unistd.h>
#else
#include <pthread.h>
#endif
......@@ -168,12 +171,14 @@ inline int utc_minutes_offset(const std::tm& tm = details::os::localtime())
#endif
}
//Return current thread id as 64 bit integer
inline uint64_t thread_id()
{
#ifdef _WIN32
return ::GetCurrentThreadId();
#elif __linux__
return (uint64_t) syscall(SYS_gettid);
#else
return (uint64_t) pthread_self();
#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