mirror of
https://github.com/FEX-Emu/FEX.git
synced 2025-03-05 21:19:24 +00:00
SpinLockWait: Fixes unexpected lock success
With a contended unique lock, we forgot to reset the `Expected` value to zero. This was causing a contended mutex to incorrectly succeed. Noticed this when converting some pthread mutexes over to spinloops to remove strace noise. The reference wfe_mutex library I wrote didn't have this problem since the implementation is slightly different.
This commit is contained in:
parent
557cb593e1
commit
cce6011205
@ -259,6 +259,7 @@ namespace FEXCore::Utils::SpinWaitLock {
|
||||
do {
|
||||
// Wait until the futex is unlocked.
|
||||
Wait(Futex, 0);
|
||||
Expected = 0;
|
||||
} while (!AtomicFutex->compare_exchange_strong(Expected, Desired));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user