[llvm] [Support] Also check the value for HAVE_PTHREAD_(SETNAME/SET_NAME)_NP (PR #156294)
Brad Smith via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 01:19:10 PDT 2025
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/156294
As was already done for HAVE_PTHREAD_(GETNAME/GET_NAME)_NP
>From 404282dcc05f1d11570c449c5eacdfb5651b4415 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Mon, 1 Sep 2025 04:07:31 -0400
Subject: [PATCH] [Support] Also check the value for
HAVE_PTHREAD_(SETNAME/SET_NAME)_NP
As was already done for HAVE_PTHREAD_(GETNAME/GET_NAME)_NP
---
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 7854d6d229152..f016ed6937524 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -194,9 +194,9 @@ void llvm::set_thread_name(const Twine &Name) {
if (get_max_thread_name_length() > 0)
NameStr = NameStr.take_back(get_max_thread_name_length() - 1);
(void)NameStr;
-#if defined(HAVE_PTHREAD_SET_NAME_NP)
+#if defined(HAVE_PTHREAD_SET_NAME_NP) && HAVE_PTHREAD_SET_NAME_NP
::pthread_set_name_np(::pthread_self(), NameStr.data());
-#elif defined(HAVE_PTHREAD_SETNAME_NP)
+#elif defined(HAVE_PTHREAD_SETNAME_NP) && HAVE_PTHREAD_SETNAME_NP
#if defined(__NetBSD__)
::pthread_setname_np(::pthread_self(), "%s",
const_cast<char *>(NameStr.data()));
More information about the llvm-commits
mailing list