sys_spu: Fix overexecution of cpu_return()

This commit is contained in:
Eladash 2020-09-12 17:16:21 +03:00 committed by Ivan
parent 7ce790f369
commit 3206378ae6
2 changed files with 26 additions and 5 deletions

View File

@ -3352,10 +3352,22 @@ bool spu_thread::stop_and_signal(u32 code)
for (auto& thread : group->threads) for (auto& thread : group->threads)
{ {
if (thread && thread.get() != this) if (thread)
{ {
thread->state += cpu_flag::stop + cpu_flag::ret; thread->state.fetch_op([](bs_t<cpu_flag>& flags)
thread_ctrl::raw_notify(*thread); {
if (flags & cpu_flag::stop)
{
// In case the thread raised the ret flag itself at some point do not raise it again
return false;
}
flags += cpu_flag::stop + cpu_flag::ret;
return true;
});
if (thread.get() != this)
thread_ctrl::raw_notify(*thread);
} }
} }
@ -3365,7 +3377,6 @@ bool spu_thread::stop_and_signal(u32 code)
break; break;
} }
state += cpu_flag::stop + cpu_flag::ret;
check_state(); check_state();
return true; return true;
} }

View File

@ -1005,7 +1005,17 @@ error_code sys_spu_thread_group_terminate(ppu_thread& ppu, u32 id, s32 value)
{ {
if (thread) if (thread)
{ {
thread->state += cpu_flag::stop + cpu_flag::ret; thread->state.fetch_op([](bs_t<cpu_flag>& flags)
{
if (flags & cpu_flag::stop)
{
// In case the thread raised the ret flag itself at some point do not raise it again
return false;
}
flags += cpu_flag::stop + cpu_flag::ret;
return true;
});
} }
} }