Core::RunOnCPUThread: Avoid Global System Accessor

This commit is contained in:
mitaclaw
2024-03-22 00:24:26 -07:00
parent aea1f64873
commit 6e6b298030
5 changed files with 17 additions and 10 deletions

View File

@ -837,7 +837,7 @@ static bool PauseAndLock(Core::System& system, bool do_lock, bool unpause_on_unl
return was_unpaused;
}
void RunOnCPUThread(std::function<void()> function, bool wait_for_completion)
void RunOnCPUThread(Core::System& system, std::function<void()> function, bool wait_for_completion)
{
// If the CPU thread is not running, assume there is no active CPU thread we can race against.
if (!IsRunning() || IsCPUThread())
@ -846,8 +846,6 @@ void RunOnCPUThread(std::function<void()> function, bool wait_for_completion)
return;
}
auto& system = Core::System::GetInstance();
// Pause the CPU (set it to stepping mode).
const bool was_running = PauseAndLock(system, true, true);