Don't call lv2_obj::awake_all with empty list

Fixup after #5883
This commit is contained in:
Nekotekina 2019-08-18 16:29:02 +03:00
parent 7a3aa02dc1
commit 7db2e2537f
4 changed files with 24 additions and 7 deletions

View file

@ -179,8 +179,11 @@ error_code sys_event_queue_destroy(ppu_thread& ppu, u32 equeue_id, s32 mode)
queue->append(cpu); queue->append(cpu);
} }
if (!queue->sq.empty())
{
lv2_obj::awake_all(); lv2_obj::awake_all();
} }
}
else else
{ {
for (auto cpu : queue->sq) for (auto cpu : queue->sq)

View file

@ -317,9 +317,12 @@ error_code sys_event_flag_set(u32 id, u64 bitptn)
return false; return false;
}); });
if (tail != flag->sq.end())
{
flag->sq.erase(tail, flag->sq.end()); flag->sq.erase(tail, flag->sq.end());
lv2_obj::awake_all(); lv2_obj::awake_all();
} }
}
return CELL_OK; return CELL_OK;
} }
@ -380,8 +383,11 @@ error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr<u32> num)
flag->append(thread); flag->append(thread);
} }
if (value)
{
lv2_obj::awake_all(); lv2_obj::awake_all();
} }
}
if (ppu.test_stopped()) if (ppu.test_stopped())
{ {

View file

@ -206,7 +206,10 @@ extern void network_thread_init()
lv2_obj::append(ppu); lv2_obj::append(ppu);
} }
if (!s_to_awake.empty())
{
lv2_obj::awake_all(); lv2_obj::awake_all();
}
s_to_awake.clear(); s_to_awake.clear();
socklist.clear(); socklist.clear();

View file

@ -237,13 +237,18 @@ error_code sys_semaphore_post(ppu_thread& ppu, u32 sem_id, s32 count)
} }
// Wake threads // Wake threads
for (s32 i = std::min<s32>(-std::min<s32>(val, 0), count); i > 0; i--) const s32 to_awake = std::min<s32>(-std::min<s32>(val, 0), count);
for (s32 i = 0; i < to_awake; i++)
{ {
sem->append(verify(HERE, sem->schedule<ppu_thread>(sem->sq, sem->protocol))); sem->append(verify(HERE, sem->schedule<ppu_thread>(sem->sq, sem->protocol)));
} }
if (to_awake > 0)
{
lv2_obj::awake_all(); lv2_obj::awake_all();
} }
}
return CELL_OK; return CELL_OK;
} }