27 #if defined(__linux__)
28 #include <sys/syscall.h>
30 #elif defined(__APPLE__)
42 #if defined(__linux__)
45 auto lwp = syscall(SYS_gettid);
47 #elif defined(__APPLE__)
50 auto lwp = pthread_mach_thread_np(pthread_self());
55 static std::atomic<unsigned> threadNum(0);
56 thread_local
static auto lwp = ++threadNum;
60 return static_cast<unsigned>(lwp);