mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-29 06:43:17 +00:00
hot-fix: Fix race in rwlock
Resetting the owner should be before the lock is unlocked, otherwise a waiter might lock and set a new owner before its reset.
This commit is contained in:
parent
714605c6a7
commit
7f4265834a
1 changed files with 2 additions and 2 deletions
|
@ -177,13 +177,13 @@ int PS4_SYSV_ABI posix_pthread_rwlock_unlock(PthreadRwlockT* rwlock) {
|
|||
}
|
||||
|
||||
if (prwlock->owner == curthread) {
|
||||
prwlock->lock.unlock();
|
||||
prwlock->owner = nullptr;
|
||||
prwlock->lock.unlock();
|
||||
} else {
|
||||
prwlock->lock.unlock_shared();
|
||||
if (prwlock->owner == nullptr) {
|
||||
curthread->rdlock_count--;
|
||||
}
|
||||
prwlock->lock.unlock_shared();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue