From 81a1efab8e61c7611f8f0ac3b4793d25c99d605a Mon Sep 17 00:00:00 2001 From: nitsuja Date: Mon, 2 Jan 2012 01:29:16 -0800 Subject: [PATCH] fixed an issue where the CPU sometimes single-steps an extra time after pausing --- Source/Core/Common/Src/Thread.h | 7 +++++++ Source/Core/Core/Src/HW/CPU.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h index ba713ed64c..e711fcab5c 100644 --- a/Source/Core/Common/Src/Thread.h +++ b/Source/Core/Common/Src/Thread.h @@ -72,6 +72,13 @@ public: is_set = false; } + void Reset() + { + std::unique_lock lk(m_mutex); + // no other action required, since wait loops on the predicate and any lingering signal will get cleared on the first iteration + is_set = false; + } + private: class IsSet { diff --git a/Source/Core/Core/Src/HW/CPU.cpp b/Source/Core/Core/Src/HW/CPU.cpp index 69b5055c9f..0f461b0fc5 100644 --- a/Source/Core/Core/Src/HW/CPU.cpp +++ b/Source/Core/Core/Src/HW/CPU.cpp @@ -115,6 +115,7 @@ void CCPU::EnableStepping(const bool _bStepping) if (_bStepping) { PowerPC::Pause(); + m_StepEvent.Reset(); g_video_backend->EmuStateChange(EMUSTATE_CHANGE_PAUSE); DSP::GetDSPEmulator()->DSP_ClearAudioBuffer(true); }