Skip to content
Snippets Groups Projects
Commit bfa99ebb authored by Zentrik's avatar Zentrik Committed by Tobias Hieta
Browse files

Fix libFuzzer not building with pthreads on Windows (#109525)

Fixes https://github.com/llvm/llvm-project/issues/106871

(cherry picked from commit b4130bee6bfd34d8045f02fc9f951bcb5db9d85c)
parent 4f844b26
No related branches found
No related tags found
No related merge requests found
...@@ -239,6 +239,10 @@ size_t PageSize() { ...@@ -239,6 +239,10 @@ size_t PageSize() {
} }
void SetThreadName(std::thread &thread, const std::string &name) { 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); typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
HMODULE kbase = GetModuleHandleA("KernelBase.dll"); HMODULE kbase = GetModuleHandleA("KernelBase.dll");
proc ThreadNameProc = proc ThreadNameProc =
...@@ -253,6 +257,7 @@ void SetThreadName(std::thread &thread, const std::string &name) { ...@@ -253,6 +257,7 @@ void SetThreadName(std::thread &thread, const std::string &name) {
} }
} }
} }
#endif
} }
} // namespace fuzzer } // namespace fuzzer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment