mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12: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
2 changed files with 3 additions and 3 deletions
|
@ -531,6 +531,7 @@ void spu_thread::cpu_stop()
|
||||||
// Send exit status directly to the joining thread
|
// Send exit status directly to the joining thread
|
||||||
ppu->gpr[4] = group->join_state;
|
ppu->gpr[4] = group->join_state;
|
||||||
ppu->gpr[5] = group->exit_status;
|
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
|
else
|
||||||
{
|
{
|
||||||
// Subscribe to receive status in r4-r5
|
// Subscribe to receive status in r4-r5
|
||||||
|
ppu.gpr[4] = 0;
|
||||||
group->waiter = &ppu;
|
group->waiter = &ppu;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv2_obj::sleep(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())
|
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->cond.wait(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
group->join_state.release(0);
|
|
||||||
}
|
}
|
||||||
while (0);
|
while (0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue