fixed compilation when using non-microsoft compiler

This commit is contained in:
kleuter 2024-11-19 13:57:04 +01:00
parent 6ba197bce4
commit 4f4f7a7c46

View File

@ -240,6 +240,8 @@ typedef struct tagTHREADNAME_INFO
typedef HRESULT(WINAPI* SetThreadDescriptionFunc)(HANDLE, PCWSTR); typedef HRESULT(WINAPI* SetThreadDescriptionFunc)(HANDLE, PCWSTR);
#if defined(Q_CC_MSVC)
// Helper function to set the thread name using RaiseException and __try // Helper function to set the thread name using RaiseException and __try
static void setThreadNameUsingException(HANDLE threadId, LPCSTR threadName) { static void setThreadNameUsingException(HANDLE threadId, LPCSTR threadName) {
THREADNAME_INFO info; THREADNAME_INFO info;
@ -256,6 +258,8 @@ static void setThreadNameUsingException(HANDLE threadId, LPCSTR threadName) {
} }
} }
#endif // Q_CC_MSVC
void qt_set_thread_name(HANDLE threadId, const QString &name) void qt_set_thread_name(HANDLE threadId, const QString &name)
{ {
HMODULE hKernel32 = GetModuleHandleW(L"Kernel32.dll"); HMODULE hKernel32 = GetModuleHandleW(L"Kernel32.dll");