mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-14 10:21:21 +00:00
Fix sys_spu_thread_group_join wait condition
After waiting, thread group cannot be safely accessed Following #5643
This commit is contained in:
parent
9ee2867247
commit
f143035af1
@ -531,6 +531,7 @@ void spu_thread::cpu_stop()
|
||||
// Send exit status directly to the joining thread
|
||||
ppu->gpr[4] = group->join_state;
|
||||
ppu->gpr[5] = group->exit_status;
|
||||
group->join_state.release(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -659,12 +659,13 @@ error_code sys_spu_thread_group_join(ppu_thread& ppu, u32 id, vm::ptr<u32> cause
|
||||
else
|
||||
{
|
||||
// Subscribe to receive status in r4-r5
|
||||
ppu.gpr[4] = 0;
|
||||
group->waiter = &ppu;
|
||||
}
|
||||
|
||||
lv2_obj::sleep(ppu);
|
||||
|
||||
while (!group->join_state || group->run_state != SPU_THREAD_GROUP_STATUS_INITIALIZED)
|
||||
while (!ppu.gpr[4])
|
||||
{
|
||||
if (ppu.is_stopped())
|
||||
{
|
||||
@ -673,8 +674,6 @@ error_code sys_spu_thread_group_join(ppu_thread& ppu, u32 id, vm::ptr<u32> cause
|
||||
|
||||
group->cond.wait(lock);
|
||||
}
|
||||
|
||||
group->join_state.release(0);
|
||||
}
|
||||
while (0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user