mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
LV2: Optimization for timeout
This commit is contained in:
parent
cec976b70a
commit
f58b418b7d
@ -521,6 +521,12 @@ error_code sys_event_queue_receive(ppu_thread& ppu, u32 equeue_id, vm::ptr<sys_e
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!atomic_storage<ppu_thread*>::load(queue->pq))
|
||||||
|
{
|
||||||
|
// Waiters queue is empty, so the thread must have been signaled
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard lock(queue->mutex);
|
std::lock_guard lock(queue->mutex);
|
||||||
|
|
||||||
if (!queue->unqueue(queue->pq, &ppu))
|
if (!queue->unqueue(queue->pq, &ppu))
|
||||||
|
@ -240,6 +240,12 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!atomic_storage<ppu_thread*>::load(flag->sq))
|
||||||
|
{
|
||||||
|
// Waiters queue is empty, so the thread must have been signaled
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard lock(flag->mutex);
|
std::lock_guard lock(flag->mutex);
|
||||||
|
|
||||||
if (!flag->unqueue(flag->sq, &ppu))
|
if (!flag->unqueue(flag->sq, &ppu))
|
||||||
|
@ -234,6 +234,12 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mutex->load_sq())
|
||||||
|
{
|
||||||
|
// Sleep queue is empty, so the thread must have been signaled
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard lock(mutex->mutex);
|
std::lock_guard lock(mutex->mutex);
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
@ -255,6 +255,12 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!atomic_storage<ppu_thread*>::load(mutex->control.raw().sq))
|
||||||
|
{
|
||||||
|
// Waiters queue is empty, so the thread must have been signaled
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard lock(mutex->mutex);
|
std::lock_guard lock(mutex->mutex);
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
@ -196,6 +196,12 @@ error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!atomic_storage<ppu_thread*>::load(rwlock->rq))
|
||||||
|
{
|
||||||
|
// Waiters queue is empty, so the thread must have been signaled
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard lock(rwlock->mutex);
|
std::lock_guard lock(rwlock->mutex);
|
||||||
|
|
||||||
if (!rwlock->unqueue(rwlock->rq, &ppu))
|
if (!rwlock->unqueue(rwlock->rq, &ppu))
|
||||||
|
Loading…
Reference in New Issue
Block a user