diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 793c7cdc68..ee3b94dc3b 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -18,7 +18,17 @@ # define _MT #endif // _MT #include -#include + +extern "C" { +// MinGW is missing the declaration of SetThreadDescription: +WINBASEAPI +HRESULT +WINAPI +SetThreadDescription( + _In_ HANDLE hThread, + _In_ PCWSTR lpThreadDescription + ); +} QT_BEGIN_NAMESPACE @@ -246,13 +256,11 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi data->ensureEventDispatcher(); data->eventDispatcher.loadRelaxed()->startingUp(); -#if defined(Q_CC_MSVC) // sets the name of the current thread. QString threadName = std::exchange(thr->d_func()->objectName, {}); if (Q_LIKELY(threadName.isEmpty())) threadName = QString::fromUtf8(thr->metaObject()->className()); SetThreadDescription(GetCurrentThread(), reinterpret_cast(threadName.utf16())); -#endif emit thr->started(QThread::QPrivateSignal()); QThread::setTerminationEnabled(true);