[llvm] 66b7ba5 - Add OpenBSD support to be able to retrieve the thread id
Brad Smith via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 27 18:15:45 PDT 2020
Author: Brad Smith
Date: 2020-06-27T21:14:44-04:00
New Revision: 66b7ba52b7b49cb712c337b934440049ab94454b
URL: https://github.com/llvm/llvm-project/commit/66b7ba52b7b49cb712c337b934440049ab94454b
DIFF: https://github.com/llvm/llvm-project/commit/66b7ba52b7b49cb712c337b934440049ab94454b.diff
LOG: Add OpenBSD support to be able to retrieve the thread id
Added:
Modified:
llvm/lib/Support/Unix/Threading.inc
Removed:
################################################################################
diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc
index 5c1bfc5620c6..9c1f1166b9ec 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -37,6 +37,10 @@
#include <lwp.h> // For _lwp_self()
#endif
+#if defined(__OpenBSD__)
+#include <unistd.h> // For getthrid()
+#endif
+
#if defined(__linux__)
#include <sched.h> // For sched_getaffinity
#include <sys/syscall.h> // For syscall codes
@@ -105,6 +109,8 @@ uint64_t llvm::get_threadid() {
return uint64_t(pthread_getthreadid_np());
#elif defined(__NetBSD__)
return uint64_t(_lwp_self());
+#elif defined(__OpenBSD__)
+ return uint64_t(getthrid());
#elif defined(__ANDROID__)
return uint64_t(gettid());
#elif defined(__linux__)
More information about the llvm-commits
mailing list