Skip to content

[llvm][Support] Determine the max thread length on Haiku #107801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

brad0
Copy link
Contributor

@brad0 brad0 commented Sep 9, 2024

Haiku has pthread_setname_np() / pthread_getname_np().

Haiku has pthread_setname_np() / pthread_getname_np().
@llvmbot
Copy link
Member

llvmbot commented Sep 9, 2024

@llvm/pr-subscribers-llvm-support

Author: Brad Smith (brad0)

Changes

Haiku has pthread_setname_np() / pthread_getname_np().


Full diff: https://github.com/llvm/llvm-project/pull/107801.diff

1 Files Affected:

  • (modified) llvm/lib/Support/Unix/Threading.inc (+6)
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__)

@brad0 brad0 requested a review from devnexen September 9, 2024 02:43
@brad0
Copy link
Contributor Author

brad0 commented Sep 9, 2024

cc @korli

@brad0 brad0 merged commit 1c334de into llvm:main Sep 10, 2024
10 checks passed
@brad0 brad0 deleted the haiku_llvm_support_threads branch September 10, 2024 07:12
@korli
Copy link
Contributor

korli commented Sep 10, 2024

@brad0 just a note that PTHREAD_MAX_NAMELEN_NP should also be defined in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants