Skip to content

Commit 66b7ba5

Browse files
committed
Add OpenBSD support to be able to retrieve the thread id
1 parent 8cd117c commit 66b7ba5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Support/Unix/Threading.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
#include <lwp.h> // For _lwp_self()
3838
#endif
3939

40+
#if defined(__OpenBSD__)
41+
#include <unistd.h> // For getthrid()
42+
#endif
43+
4044
#if defined(__linux__)
4145
#include <sched.h> // For sched_getaffinity
4246
#include <sys/syscall.h> // For syscall codes
@@ -105,6 +109,8 @@ uint64_t llvm::get_threadid() {
105109
return uint64_t(pthread_getthreadid_np());
106110
#elif defined(__NetBSD__)
107111
return uint64_t(_lwp_self());
112+
#elif defined(__OpenBSD__)
113+
return uint64_t(getthrid());
108114
#elif defined(__ANDROID__)
109115
return uint64_t(gettid());
110116
#elif defined(__linux__)

0 commit comments

Comments
 (0)