Merge pull request #1682 from NZJenkins/lockfs_perf

Improve LockFS performance
This commit is contained in:
RadWolfie 2019-07-27 20:47:49 -05:00 committed by GitHub
commit ec3f97e4f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -128,12 +128,12 @@ __declspec(naked) void LockFS()
// Backup Registers
pushfd
pushad
jmp entry
// Spin until we can aquire the lock
spinlock :
call SwitchToThread // Give other threads chance to run, prevents hogging entire timeslice waiting for spinlock
// We do this here loop because SwitchToThread will overwrite eax, so it cannot go below
// It's not worth wasting the extra cycles of pushing/popping eax to the stack around this call
call SwitchToThread // Give other threads a chance to run if we couldn't get the lock
entry:
mov eax, 1
xchg eax, fs_lock
test eax, eax