mirror of https://github.com/RPCS3/rpcs3.git
Fix Emulator::Pause race with IDM
This commit is contained in:
parent
aad5283786
commit
d51bb8b1cc
|
@ -597,6 +597,23 @@ cpu_thread::~cpu_thread()
|
||||||
cpu_thread::cpu_thread(u32 id)
|
cpu_thread::cpu_thread(u32 id)
|
||||||
: id(id)
|
: id(id)
|
||||||
{
|
{
|
||||||
|
while (Emu.GetStatus() == system_state::paused)
|
||||||
|
{
|
||||||
|
// Solve race between Emulator::Pause and this construction of thread which most likely is guarded by IDM mutex
|
||||||
|
state += cpu_flag::dbg_global_pause;
|
||||||
|
|
||||||
|
if (Emu.GetStatus() != system_state::paused)
|
||||||
|
{
|
||||||
|
// Emulator::Resume was called inbetween
|
||||||
|
state -= cpu_flag::dbg_global_pause;
|
||||||
|
|
||||||
|
// Recheck if state is inconsistent
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
g_threads_created++;
|
g_threads_created++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue