[llvm] Add support for retrieving the thread ID on DragonFly BSD (PR #106938)
Brad Smith via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 1 21:59:29 PDT 2024
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/106938
None
>From ecee203befbef298dfb665465f84f39bfd8a233c Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Mon, 2 Sep 2024 00:56:54 -0400
Subject: [PATCH] Add support for retrieving the thread ID on DragonFly BSD
---
llvm/lib/Support/Unix/Threading.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc
index 6ba6395e6b8d63..1812d990f21ac1 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -29,7 +29,7 @@
#include <pthread.h>
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#include <pthread_np.h> // For pthread_getthreadid_np() / pthread_set_name_np()
#endif
@@ -121,7 +121,7 @@ uint64_t llvm::get_threadid() {
return InitSelf;
}();
return Self;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
return uint64_t(pthread_getthreadid_np());
#elif defined(__NetBSD__)
return uint64_t(_lwp_self());
More information about the llvm-commits
mailing list