From d5c041befbb60e7bfce14af2eaf1e8c686524209 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 6 Feb 2021 16:26:59 -0600 Subject: Add ::Sleep(0) in engine loop to unblock PostThreadMessage --- src/engine/engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index bc27cb14..98c98661 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -776,6 +776,12 @@ static HRESULT RunApplication( } else { + // When the BA makes a request from its own thread, it's common for the PostThreadMessage in externalengine.cpp + // to block until this thread waits on something. It's also common for Detect and Plan to never wait on something. + // In the extreme case, the engine could be elevating in Apply before the Detect call returned to the BA. + // This helps to avoid that situation, which could be blocking a UI thread. + ::Sleep(0); + ProcessMessage(pEngineState, &msg); } } -- cgit v1.2.3-55-g6feb