summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorDentomologist <dentomologist@gmail.com>2023-06-04 14:11:52 -0700
committerDentomologist <dentomologist@gmail.com>2025-10-26 18:01:51 -0700
commit2d888ea4d3c8f7957f15ad7428555cc03334acb3 (patch)
treefeaa2fc2a6c4f54780e6dd536a5a2ddba984cacf /Source/Core
parentc9c8461d366f383e1e121996422bf001deae57c1 (diff)
Core: Remove unnecessary PauseAndLock parameters
PauseAndLock is now only called with do_lock=true, and unpause_on_unlock only ever was used when do_lock is false (which is now handled in RestoreStateAndUnlock instead), so both parameters are unnecessary.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Core.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index 93db0fc28f..81f1695ea9 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -768,42 +768,26 @@ void SaveScreenShot(std::string_view name)
g_frame_dumper->SaveScreenshot(fmt::format("{}{}.png", GenerateScreenshotFolderPath(), name));
}
-static bool PauseAndLock(Core::System& system, bool do_lock, bool unpause_on_unlock)
+static bool PauseAndLock(Core::System& system)
{
// WARNING: PauseAndLock is not fully threadsafe so is only valid on the Host Thread
if (!IsRunning(system))
return true;
- bool was_unpaused = true;
- if (do_lock)
- {
- // first pause the CPU
- // This acquires a wrapper mutex and converts the current thread into
- // a temporary replacement CPU Thread.
- was_unpaused = system.GetCPU().PauseAndLock();
- }
+ // First pause the CPU. This acquires a wrapper mutex and converts the current thread into
+ // a temporary replacement CPU Thread.
+ const bool was_unpaused = system.GetCPU().PauseAndLock();
// audio has to come after CPU, because CPU thread can wait for audio thread (m_throttle).
- system.GetDSP().GetDSPEmulator()->PauseAndLock(do_lock);
+ system.GetDSP().GetDSPEmulator()->PauseAndLock(true);
// video has to come after CPU, because CPU thread can wait for video thread
// (s_efbAccessRequested).
- system.GetFifo().PauseAndLock(do_lock, false);
+ system.GetFifo().PauseAndLock(true, false);
ResetRumble();
- // CPU is unlocked last because CPU::PauseAndLock contains the synchronization
- // mechanism that prevents CPU::Break from racing.
- if (!do_lock)
- {
- // The CPU is responsible for managing the Audio and FIFO state so we use its
- // mechanism to unpause them. If we unpaused the systems above when releasing
- // the locks then they could call CPU::Break which would require detecting it
- // and re-pausing with CPU::SetStepping.
- system.GetCPU().RestoreStateAndUnlock(unpause_on_unlock);
- }
-
return was_unpaused;
}
@@ -838,7 +822,7 @@ void RunOnCPUThread(Core::System& system, Common::MoveOnlyFunction<void()> funct
}
// Pause the CPU (set it to stepping mode).
- const bool was_running = PauseAndLock(system, true, true);
+ const bool was_running = PauseAndLock(system);
// Queue the job function.
if (wait_for_completion)
@@ -1073,7 +1057,7 @@ CPUThreadGuard::CPUThreadGuard(Core::System& system)
: m_system(system), m_was_cpu_thread(IsCPUThread())
{
if (!m_was_cpu_thread)
- m_was_unpaused = PauseAndLock(system, true, true);
+ m_was_unpaused = PauseAndLock(system);
}
CPUThreadGuard::~CPUThreadGuard()