mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[AOT] Fix CPU consumption (#19653)
Wait until object is signaled instead
This commit is contained in:
@@ -54,12 +54,14 @@ AlwaysOnTop::AlwaysOnTop(bool useLLKH) :
|
|||||||
|
|
||||||
AlwaysOnTop::~AlwaysOnTop()
|
AlwaysOnTop::~AlwaysOnTop()
|
||||||
{
|
{
|
||||||
|
m_running = false;
|
||||||
|
|
||||||
if (m_hPinEvent)
|
if (m_hPinEvent)
|
||||||
{
|
{
|
||||||
|
// Needed to unblock MsgWaitForMultipleObjects one last time
|
||||||
|
SetEvent(m_hPinEvent);
|
||||||
CloseHandle(m_hPinEvent);
|
CloseHandle(m_hPinEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running = false;
|
|
||||||
m_thread.join();
|
m_thread.join();
|
||||||
|
|
||||||
CleanUp();
|
CleanUp();
|
||||||
@@ -280,7 +282,11 @@ void AlwaysOnTop::RegisterLLKH()
|
|||||||
MSG msg;
|
MSG msg;
|
||||||
while (m_running)
|
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)
|
switch (dwEvt)
|
||||||
{
|
{
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
|
|||||||
Reference in New Issue
Block a user