From bebeba29c30e651156ba2ffe7717bd8ee4573be3 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Fri, 2 Jun 2023 16:15:41 -0700 Subject: [PATCH] CPU: Convert static variable to class member Make s_have_fake_cpu_thread a class member instead. In addition to getting rid of a bit of static state, this simplifies refactoring in an upcoming commit. --- Source/Core/Core/HW/CPU.cpp | 8 +++----- Source/Core/Core/HW/CPU.h | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/HW/CPU.cpp b/Source/Core/Core/HW/CPU.cpp index 82b0cb9c4b4..fb9c89f9027 100644 --- a/Source/Core/Core/HW/CPU.cpp +++ b/Source/Core/Core/HW/CPU.cpp @@ -353,8 +353,6 @@ void CPUManager::Continue() bool CPUManager::PauseAndLock(bool do_lock, bool unpause_on_unlock, bool control_adjacent) { - // NOTE: This is protected by m_stepping_lock. - static bool s_have_fake_cpu_thread = false; bool was_unpaused = false; if (do_lock) @@ -380,16 +378,16 @@ bool CPUManager::PauseAndLock(bool do_lock, bool unpause_on_unlock, bool control // depth counter instead of being a boolean. if (!Core::IsCPUThread()) { - s_have_fake_cpu_thread = true; + m_have_fake_cpu_thread = true; Core::DeclareAsCPUThread(); } } else { // Only need the stepping lock for this - if (s_have_fake_cpu_thread) + if (m_have_fake_cpu_thread) { - s_have_fake_cpu_thread = false; + m_have_fake_cpu_thread = false; Core::UndeclareAsCPUThread(); } diff --git a/Source/Core/Core/HW/CPU.h b/Source/Core/Core/HW/CPU.h index 438a48763bb..13e915ba9a4 100644 --- a/Source/Core/Core/HW/CPU.h +++ b/Source/Core/Core/HW/CPU.h @@ -122,6 +122,8 @@ private: // deadlock because of the order inversion. (A -> X,Y; B -> Y,X; A waits for // B, B waits for A) std::mutex m_stepping_lock; + // Protected by m_stepping_lock. + bool m_have_fake_cpu_thread = false; // Primary lock. Protects changing m_state, requesting instruction stepping and // pause-and-locking.