aboutsummaryrefslogtreecommitdiff
path: root/src/common/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/thread.cpp')
-rw-r--r--src/common/thread.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common/thread.cpp b/src/common/thread.cpp
index 832232cd15..f5abe46324 100644
--- a/src/common/thread.cpp
+++ b/src/common/thread.cpp
@@ -81,7 +81,10 @@ void SetCurrentThreadPriority(ThreadPriority new_priority) {
// Sets the debugger-visible name of the current thread.
void SetCurrentThreadName(const char* name) {
- SetThreadDescription(GetCurrentThread(), UTF8ToUTF16W(name).data());
+ if (auto pf = (decltype(&SetThreadDescription))(void*)GetProcAddress(GetModuleHandle(TEXT("KernelBase.dll")), "SetThreadDescription"); pf)
+ pf(GetCurrentThread(), UTF8ToUTF16W(name).data()); // Windows 10+
+ else
+ ; // No-op
}
#else // !MSVC_VER, so must be POSIX threads