diff options
Diffstat (limited to 'src/hook.c')
-rw-r--r-- | src/hook.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -442,6 +442,9 @@ static VOID EnterSpinLock(VOID) // Wait until the flag is FALSE. while (InterlockedCompareExchange(&g_isLocked, TRUE, FALSE) != FALSE) { + // No need to generate a memory barrier here, since InterlockedCompareExchange() + // generates a full memory barrier itself. + // Prevent the loop from being too busy. if (spinCount < 32) Sleep(0); @@ -455,6 +458,9 @@ static VOID EnterSpinLock(VOID) //------------------------------------------------------------------------- static VOID LeaveSpinLock(VOID) { + // No need to generate a memory barrier here, since InterlockedExchange() + // generates a full memory barrier itself. + InterlockedExchange(&g_isLocked, FALSE); } |