7 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_2
)
8 int pthread_threadid_np(pthread_t
, __uint64_t
*);
9 #elif defined(__linux__)
10 #include <sys/syscall.h>
12 #elif defined(__FreeBSD__)
13 #include <pthread_np.h>
14 #elif defined(__NetBSD__)
20 inline uint64_t get_thread_id() {
21 #if defined(__APPLE__)
23 pthread_threadid_np(pthread_self(), &tid
);
25 #elif defined(__linux__)
26 return syscall(__NR_gettid
);
27 #elif defined(__FreeBSD__)
28 return static_cast<uint64_t>(pthread_getthreadid_np());
29 #elif defined(__NetBSD__)
30 // Technically lwpid_t is 32-bit signed integer
31 return static_cast<uint64_t>(_lwp_self());
33 return static_cast<uint64_t>(::GetCurrentThreadId());
39 #endif // LLDB_THREAD_H