Skip to content

Commit

Permalink
Core/CPU: Do not yield to UI from CPU methods
Browse files Browse the repository at this point in the history
Core::RunAsCPUThread may be called from Qt signals, and if code yields to UI there
then it results in infinite recursion
  • Loading branch information
CookiePLMonster committed Aug 18, 2019
1 parent 7520306 commit 2bc9e09
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions Source/Core/Core/HW/CPU.cpp
Expand Up @@ -183,10 +183,7 @@ void Stop()

while (s_state_cpu_thread_active)
{
std::cv_status status =
s_state_cpu_idle_cvar.wait_for(state_lock, std::chrono::milliseconds(100));
if (status == std::cv_status::timeout)
Host_YieldToUI();
s_state_cpu_idle_cvar.wait(state_lock);
}

RunAdjacentSystems(false);
Expand Down Expand Up @@ -252,10 +249,7 @@ void EnableStepping(bool stepping)

while (s_state_cpu_thread_active)
{
std::cv_status status =
s_state_cpu_idle_cvar.wait_for(state_lock, std::chrono::milliseconds(100));
if (status == std::cv_status::timeout)
Host_YieldToUI();
s_state_cpu_idle_cvar.wait(state_lock);
}

RunAdjacentSystems(false);
Expand Down Expand Up @@ -303,10 +297,7 @@ bool PauseAndLock(bool do_lock, bool unpause_on_unlock, bool control_adjacent)

while (s_state_cpu_thread_active)
{
std::cv_status status =
s_state_cpu_idle_cvar.wait_for(state_lock, std::chrono::milliseconds(100));
if (status == std::cv_status::timeout)
Host_YieldToUI();
s_state_cpu_idle_cvar.wait(state_lock);
}

if (control_adjacent)
Expand Down

0 comments on commit 2bc9e09

Please sign in to comment.