[llvm] 1c334de - [llvm][Support] Determine the max thread length on Haiku (#107801)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 00:12:42 PDT 2024


Author: Brad Smith
Date: 2024-09-10T03:12:38-04:00
New Revision: 1c334debecd70bd28e61a36c40c3f96cf5467331

URL: https://github.com/llvm/llvm-project/commit/1c334debecd70bd28e61a36c40c3f96cf5467331
DIFF: https://github.com/llvm/llvm-project/commit/1c334debecd70bd28e61a36c40c3f96cf5467331.diff

LOG: [llvm][Support] Determine the max thread length on Haiku (#107801)

Haiku has pthread_setname_np() / pthread_getname_np().

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 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