mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
Fix sys_rwlock_wlock timedout event
If the rwlock is currently acquired by a writer signaling readers is wrong and will lead to EPERM for wunlock! Only signal blocked readers if the rwlock is currently acquired by readers
This commit is contained in:
parent
ca08418dc1
commit
4e2650af91
@ -343,10 +343,12 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout)
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the last waiter quit the writer sleep queue, readers must acquire the lock
|
||||
if (!rwlock->rq.empty() && rwlock->wq.empty())
|
||||
// If the last waiter quit the writer sleep queue, wake blocked readers
|
||||
if (!rwlock->rq.empty() && rwlock->wq.empty() && rwlock->owner < 0)
|
||||
{
|
||||
rwlock->owner = (s64{-2} * rwlock->rq.size()) | 1;
|
||||
verify(HERE), rwlock->owner & 1;
|
||||
|
||||
rwlock->owner -= s64{2} * rwlock->rq.size();
|
||||
|
||||
while (auto cpu = rwlock->schedule<ppu_thread>(rwlock->rq, SYS_SYNC_PRIORITY))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user