From e6b732792813cf49a23ba2f780c55f8d3279183e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 21 Oct 2024 13:01:02 +0200 Subject: Vendor import of llvm-project branch release/19.x llvmorg-19.1.2-0-g7ba7d8e2f7b6, a.k.a. 19.1.2 release. --- compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp') diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp index db80eb383885..73eea07cf869 100644 --- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp @@ -239,6 +239,10 @@ size_t PageSize() { } void SetThreadName(std::thread &thread, const std::string &name) { +#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \ + defined(_GLIBCXX_GCC_GTHR_POSIX_H) + (void)pthread_setname_np(thread.native_handle(), name.c_str()); +#else typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR); HMODULE kbase = GetModuleHandleA("KernelBase.dll"); proc ThreadNameProc = @@ -253,6 +257,7 @@ void SetThreadName(std::thread &thread, const std::string &name) { } } } +#endif } } // namespace fuzzer -- cgit v1.3