[llvm] [llvm][Support] Determine the max thread length on Haiku (PR #107801)
Brad Smith via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 8 19:42:02 PDT 2024
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/107801
Haiku has pthread_setname_np() / pthread_getname_np().
>From 202f8e66a753a32bb98ecc75254b97eab399cb6c Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Sun, 8 Sep 2024 22:35:31 +0000
Subject: [PATCH] [llvm][Support] Determine the max thread length on Haiku
Haiku has pthread_setname_np() / pthread_getname_np().
---
llvm/lib/Support/Unix/Threading.inc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc
index 43e18c3a963abf..0afd1d817f88e6 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -55,6 +55,10 @@
#include <unistd.h> // For syscall()
#endif
+#if defined(__HAIKU__)
+#include <OS.h> // For B_OS_NAME_LENGTH
+#endif
+
namespace llvm {
pthread_t
llvm_execute_on_thread_impl(void *(*ThreadFunc)(void *), void *Arg,
@@ -139,6 +143,8 @@ uint64_t llvm::get_threadid() {
static constexpr uint32_t get_max_thread_name_length_impl() {
#if defined(PTHREAD_MAX_NAMELEN_NP)
return PTHREAD_MAX_NAMELEN_NP;
+#elif defined(__HAIKU__)
+ return B_OS_NAME_LENGTH;
#elif defined(__APPLE__)
return 64;
#elif defined(__sun__) && defined(__svr4__)
More information about the llvm-commits
mailing list