mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-09 17:49:45 +00:00
sys_spu_thread_group_terminate fixed
This commit is contained in:
parent
d234493b4a
commit
476b9020ce
1 changed files with 33 additions and 2 deletions
|
@ -467,13 +467,43 @@ s32 sys_spu_thread_group_terminate(u32 id, s32 value)
|
||||||
|
|
||||||
LV2_LOCK;
|
LV2_LOCK;
|
||||||
|
|
||||||
|
// seems the id can be either SPU Thread Group or SPU Thread
|
||||||
|
|
||||||
std::shared_ptr<spu_group_t> group;
|
std::shared_ptr<spu_group_t> group;
|
||||||
if (!Emu.GetIdManager().GetIDData(id, group))
|
std::shared_ptr<CPUThread> thread = Emu.GetCPU().GetThread(id, CPU_THREAD_SPU);
|
||||||
|
|
||||||
|
if (!Emu.GetIdManager().GetIDData(id, group) && !thread)
|
||||||
{
|
{
|
||||||
return CELL_ESRCH;
|
return CELL_ESRCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CELL_EPERM is not returned (can't check the condition)
|
auto& spu = static_cast<SPUThread&>(*thread);
|
||||||
|
|
||||||
|
if (thread)
|
||||||
|
{
|
||||||
|
if (group)
|
||||||
|
{
|
||||||
|
throw __FUNCTION__;
|
||||||
|
}
|
||||||
|
|
||||||
|
group = spu.tg.lock();
|
||||||
|
|
||||||
|
for (auto& t : group->threads)
|
||||||
|
{
|
||||||
|
// find primary (?) thread and compare it with the one specified
|
||||||
|
if (t)
|
||||||
|
{
|
||||||
|
if (t == thread)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return CELL_EPERM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (group->state <= SPU_THREAD_GROUP_STATUS_INITIALIZED || group->state == SPU_THREAD_GROUP_STATUS_WAITING || group->state == SPU_THREAD_GROUP_STATUS_WAITING)
|
if (group->state <= SPU_THREAD_GROUP_STATUS_INITIALIZED || group->state == SPU_THREAD_GROUP_STATUS_WAITING || group->state == SPU_THREAD_GROUP_STATUS_WAITING)
|
||||||
{
|
{
|
||||||
|
@ -495,6 +525,7 @@ s32 sys_spu_thread_group_terminate(u32 id, s32 value)
|
||||||
group->exit_status = value;
|
group->exit_status = value;
|
||||||
group->join_state |= SPU_TGJSF_TERMINATED;
|
group->join_state |= SPU_TGJSF_TERMINATED;
|
||||||
group->join_cv.notify_one();
|
group->join_cv.notify_one();
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue