RawSPU: reset status register on start

Was proposed by @elad335
Implemented as atomic op
This commit is contained in:
Nekotekina 2018-03-25 03:41:55 +03:00
commit 78dbc4fb5f

View file

@ -106,7 +106,16 @@ bool RawSPUThread::write_reg(const u32 addr, const u32 value)
{ {
auto try_start = [this]() auto try_start = [this]()
{ {
if (!status.test_and_set(SPU_STATUS_RUNNING)) if (status.atomic_op([](u32& status)
{
if (status & SPU_STATUS_RUNNING)
{
return false;
}
status = SPU_STATUS_RUNNING;
return true;
}))
{ {
run(); run();
} }