mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #2396 from Sonicadvance1/fix_racing_cpu_core
Fix a race condition when pausing the CPU core.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Event.h"
|
||||
#include "Common/FPURoundMode.h"
|
||||
#include "Common/MathUtil.h"
|
||||
|
||||
@ -33,6 +34,7 @@ static volatile CPUState state = CPU_POWERDOWN;
|
||||
|
||||
Interpreter * const interpreter = Interpreter::getInstance();
|
||||
static CoreMode mode;
|
||||
static Common::Event s_state_change;
|
||||
|
||||
Watches watches;
|
||||
BreakPoints breakpoints;
|
||||
@ -238,16 +240,31 @@ void Start()
|
||||
|
||||
void Pause()
|
||||
{
|
||||
volatile CPUState old_state = state;
|
||||
state = CPU_STEPPING;
|
||||
|
||||
// Wait for the CPU core to leave
|
||||
if (old_state == CPU_RUNNING)
|
||||
s_state_change.WaitFor(std::chrono::seconds(1));
|
||||
Host_UpdateDisasmDialog();
|
||||
}
|
||||
|
||||
void Stop()
|
||||
{
|
||||
volatile CPUState old_state = state;
|
||||
state = CPU_POWERDOWN;
|
||||
|
||||
// Wait for the CPU core to leave
|
||||
if (old_state == CPU_RUNNING)
|
||||
s_state_change.WaitFor(std::chrono::seconds(1));
|
||||
Host_UpdateDisasmDialog();
|
||||
}
|
||||
|
||||
void FinishStateMove()
|
||||
{
|
||||
s_state_change.Set();
|
||||
}
|
||||
|
||||
void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst)
|
||||
{
|
||||
switch (MMCR0.PMC1SELECT)
|
||||
|
Reference in New Issue
Block a user