lv2: Minor optimization for "awake all" threads in sleep queue

This commit is contained in:
Eladash 2020-05-02 11:18:25 +03:00 committed by Ivan
parent b84b8f4db4
commit 37ce7056ac
3 changed files with 5 additions and 5 deletions

View File

@ -377,8 +377,8 @@ error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr<u32> num)
// Set count
value = ::size32(flag->sq);
// Signal all threads to return CELL_ECANCELED
while (auto thread = flag->schedule<ppu_thread>(flag->sq, flag->protocol))
// Signal all threads to return CELL_ECANCELED (protocol does not matter)
for (auto thread : ::as_rvalue(std::move(flag->sq)))
{
auto& ppu = static_cast<ppu_thread&>(*thread);

View File

@ -231,7 +231,7 @@ error_code _sys_lwcond_signal_all(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id
u32 result = 0;
while (const auto cpu = cond.schedule<ppu_thread>(cond.sq, cond.protocol))
for (const auto cpu : ::as_rvalue(std::move(cond.sq)))
{
cond.waiters--;

View File

@ -363,7 +363,7 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout)
});
// Protocol doesn't matter here since they are all enqueued anyways
while (auto cpu = rwlock->schedule<ppu_thread>(rwlock->rq, SYS_SYNC_FIFO))
for (auto cpu : ::as_rvalue(std::move(rwlock->rq)))
{
rwlock->append(cpu);
}
@ -456,7 +456,7 @@ error_code sys_rwlock_wunlock(ppu_thread& ppu, u32 rw_lock_id)
}
else if (auto readers = rwlock->rq.size())
{
while (auto cpu = rwlock->schedule<ppu_thread>(rwlock->rq, SYS_SYNC_FIFO))
for (auto cpu : ::as_rvalue(std::move(rwlock->rq)))
{
rwlock->append(cpu);
}