This commit is contained in:
Pokechu22 2025-05-29 02:31:29 +02:00 committed by GitHub
commit 7f5389e932
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -1052,15 +1052,15 @@ void UpdateInputGate(bool require_focus, bool require_full_focus)
}
CPUThreadGuard::CPUThreadGuard(Core::System& system)
: m_system(system), m_was_cpu_thread(IsCPUThread())
: m_system(system), m_was_cpu_thread(IsCPUThread()), m_has_cpu_thread(IsRunningAndStarted())
{
if (!m_was_cpu_thread)
m_was_unpaused = PauseAndLock(system, true, true);
if (m_has_cpu_thread && !m_was_cpu_thread)
m_was_unpaused = PauseAndLock(m_system, true, true);
}
CPUThreadGuard::~CPUThreadGuard()
{
if (!m_was_cpu_thread)
if (m_has_cpu_thread && !m_was_cpu_thread)
PauseAndLock(m_system, false, m_was_unpaused);
}

View File

@ -115,6 +115,7 @@ public:
private:
Core::System& m_system;
const bool m_was_cpu_thread;
const bool m_has_cpu_thread;
bool m_was_unpaused = false;
};