mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
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.
This commit is contained in:
parent
c22a483431
commit
bebeba29c3
@ -353,8 +353,6 @@ void CPUManager::Continue()
|
|||||||
|
|
||||||
bool CPUManager::PauseAndLock(bool do_lock, bool unpause_on_unlock, bool control_adjacent)
|
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;
|
bool was_unpaused = false;
|
||||||
|
|
||||||
if (do_lock)
|
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.
|
// depth counter instead of being a boolean.
|
||||||
if (!Core::IsCPUThread())
|
if (!Core::IsCPUThread())
|
||||||
{
|
{
|
||||||
s_have_fake_cpu_thread = true;
|
m_have_fake_cpu_thread = true;
|
||||||
Core::DeclareAsCPUThread();
|
Core::DeclareAsCPUThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Only need the stepping lock for this
|
// 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();
|
Core::UndeclareAsCPUThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -122,6 +122,8 @@ private:
|
|||||||
// deadlock because of the order inversion. (A -> X,Y; B -> Y,X; A waits for
|
// deadlock because of the order inversion. (A -> X,Y; B -> Y,X; A waits for
|
||||||
// B, B waits for A)
|
// B, B waits for A)
|
||||||
std::mutex m_stepping_lock;
|
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
|
// Primary lock. Protects changing m_state, requesting instruction stepping and
|
||||||
// pause-and-locking.
|
// pause-and-locking.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user