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__)
16 #elif defined(__OpenBSD__)
22 inline uint64_t get_thread_id() {
23 #if defined(__APPLE__)
25 pthread_threadid_np(pthread_self(), &tid
);
27 #elif defined(__linux__)
28 return syscall(__NR_gettid
);
29 #elif defined(__FreeBSD__)
30 return static_cast<uint64_t>(pthread_getthreadid_np());
31 #elif defined(__NetBSD__)
32 // Technically lwpid_t is 32-bit signed integer
33 return static_cast<uint64_t>(_lwp_self());
34 #elif defined(__OpenBSD__)
35 return static_cast<uint64_t>(getthrid());
37 return static_cast<uint64_t>(::GetCurrentThreadId());
43 #endif // LLDB_THREAD_H