Event Flag refactoring, bugfixes

This commit is contained in:
Nekotekina 2015-03-06 00:29:05 +03:00
parent 5d768bd3cf
commit e2a2709ad0
6 changed files with 305 additions and 276 deletions

View file

@ -19,14 +19,29 @@ RawSPUThread::~RawSPUThread()
void RawSPUThread::start()
{
status.write_relaxed(SPU_STATUS_RUNNING);
bool do_start;
// calling Exec() directly in SIGSEGV handler may cause problems
// (probably because Exec() creates new thread, faults of this thread aren't handled by this handler anymore)
Emu.GetCallbackManager().Async([this](PPUThread& PPU)
status.atomic_op([&do_start](u32& status)
{
FastRun();
if (status & SPU_STATUS_RUNNING)
{
do_start = false;
}
else
{
status = SPU_STATUS_RUNNING;
do_start = true;
}
});
if (do_start)
{
// starting thread directly in SIGSEGV handler may cause problems
Emu.GetCallbackManager().Async([this](PPUThread& PPU)
{
FastRun();
});
}
}
bool RawSPUThread::ReadReg(const u32 addr, u32& value)