[+] Qt6Core:GetExitThreadHandle symbol for Win32 (only) (todo: figure something out for posix)

Change-Id: I3f63ca13340dbf04ad4af34215baa1d259d34445
This commit is contained in:
Reece Wilson 2024-02-01 21:28:13 +00:00
parent a5b41489e5
commit d4827ef266

View File

@ -106,6 +106,11 @@ static QList<QThread *> qt_adopted_qthreads;
Q_CONSTINIT static QBasicMutex qt_adopted_thread_watcher_mutex;
static DWORD qt_adopted_thread_watcher_id = 0;
static HANDLE qt_adopted_thread_wakeup = 0;
static HANDLE qt_adopted_thread_exit = 0;
extern "C" __declspec(dllexport)HANDLE GetExitThreadHandle() {
return qt_adopted_thread_exit;
}
/*!
\internal
@ -131,8 +136,15 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread)
qt_adopted_thread_wakeup = CreateEvent(0, false, false, 0);
qt_adopted_thread_handles.prepend(qt_adopted_thread_wakeup);
}
if (qt_adopted_thread_exit == 0) {
qt_adopted_thread_exit = CreateEvent(0, false, false, 0);
}
CloseHandle(CreateThread(0, 0, qt_adopted_thread_watcher_function, 0, 0, &qt_adopted_thread_watcher_id));
if (qt_adopted_thread_exit) {
ResetEvent(qt_adopted_thread_exit);
}
} else {
SetEvent(qt_adopted_thread_wakeup);
}
@ -211,6 +223,10 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID)
if (threadData)
threadData->deref();
if (qt_adopted_thread_exit) {
SetEvent(qt_adopted_thread_exit);
}
return 0;
}