hot-fix: Fix race in rwlock
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

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:
TheTurtle 2024-12-12 03:33:49 +02:00 committed by GitHub
parent 714605c6a7
commit 7f4265834a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;