[llvm] r353367 - Add OpenBSD support to be able to get the thread name
Brad Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 6 18:06:59 PST 2019
Author: brad
Date: Wed Feb 6 18:06:58 2019
New Revision: 353367
URL: http://llvm.org/viewvc/llvm-project?rev=353367&view=rev
Log:
Add OpenBSD support to be able to get the thread name
Modified:
llvm/trunk/lib/Support/Unix/Threading.inc
Modified: llvm/trunk/lib/Support/Unix/Threading.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Threading.inc?rev=353367&r1=353366&r2=353367&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Threading.inc (original)
+++ llvm/trunk/lib/Support/Unix/Threading.inc Wed Feb 6 18:06:58 2019
@@ -202,6 +202,12 @@ void llvm::get_thread_name(SmallVectorIm
::pthread_getname_np(::pthread_self(), buf, len);
Name.append(buf, buf + strlen(buf));
+#elif defined(__OpenBSD__)
+ constexpr uint32_t len = get_max_thread_name_length_impl();
+ char buf[len];
+ ::pthread_get_name_np(::pthread_self(), buf, len);
+
+ Name.append(buf, buf + strlen(buf));
#elif defined(__linux__)
#if HAVE_PTHREAD_GETNAME_NP
constexpr uint32_t len = get_max_thread_name_length_impl();
More information about the llvm-commits
mailing list