[AOT] Fix CPU consumption (#19653)

Wait until object is signaled instead
This commit is contained in:
Stefan Markovic
2022-07-28 17:53:40 +02:00
committed by GitHub
parent 9fb9c6a61e
commit bdddea9b04

View File

@@ -54,12 +54,14 @@ AlwaysOnTop::AlwaysOnTop(bool useLLKH) :
AlwaysOnTop::~AlwaysOnTop()
{
m_running = false;
if (m_hPinEvent)
{
// Needed to unblock MsgWaitForMultipleObjects one last time
SetEvent(m_hPinEvent);
CloseHandle(m_hPinEvent);
}
m_running = false;
m_thread.join();
CleanUp();
@@ -280,7 +282,11 @@ void AlwaysOnTop::RegisterLLKH()
MSG msg;
while (m_running)
{
DWORD dwEvt = MsgWaitForMultipleObjects(1, &m_hPinEvent, false, 0, QS_ALLINPUT);
DWORD dwEvt = MsgWaitForMultipleObjects(1, &m_hPinEvent, false, INFINITE, QS_ALLINPUT);
if (!m_running)
{
break;
}
switch (dwEvt)
{
case WAIT_OBJECT_0: