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,7 +179,10 @@ error_code sys_event_queue_destroy(ppu_thread& ppu, u32 equeue_id, s32 mode)
queue->append(cpu);
}
lv2_obj::awake_all();
if (!queue->sq.empty())
{
lv2_obj::awake_all();
}
}
else
{

View File

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

View File

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

View File

@ -237,12 +237,17 @@ error_code sys_semaphore_post(ppu_thread& ppu, u32 sem_id, s32 count)
}
// 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)));
}
lv2_obj::awake_all();
if (to_awake > 0)
{
lv2_obj::awake_all();
}
}
return CELL_OK;