diff options
author | Tsuda Kageyu <tsuda.kageyu@gmail.com> | 2015-05-29 12:03:00 +0300 |
---|---|---|
committer | Tsuda Kageyu <tsuda.kageyu@gmail.com> | 2015-05-29 12:03:00 +0300 |
commit | fb9bec557b36722ce92e60bb3712fec6395383b7 (patch) | |
tree | 641e6ae2431ef8fd44565f7664adf17c8632d442 /src | |
parent | f0e15aea84f6e6eabdce975a19223f5a7cf23e8b (diff) |
Remove MemoryBarrierEx().
InterlockedCompareExchange() and InterlockedExchange() generate full memory barrier themselves.
Diffstat (limited to 'src')
-rw-r--r-- | src/hook.c | 15 |
1 files changed, 0 insertions, 15 deletions
@@ -435,18 +435,6 @@ static MH_STATUS EnableAllHooksLL(BOOL enable) } //------------------------------------------------------------------------- -static FORCEINLINE VOID MemoryBarrierEx() -{ -#if _MSC_VER - MemoryBarrier(); -#elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 - __sync_synchronize(); -#else - __asm__ __volatile__("" : : : "memory"); -#endif -} - -//------------------------------------------------------------------------- static VOID EnterSpinLock(VOID) { SIZE_T spinCount = 0; @@ -454,8 +442,6 @@ static VOID EnterSpinLock(VOID) // Wait until the flag is FALSE. while (InterlockedCompareExchange(&g_isLocked, TRUE, FALSE) != FALSE) { - MemoryBarrierEx(); - // Prevent the loop from being too busy. if (spinCount < 32) Sleep(0); @@ -469,7 +455,6 @@ static VOID EnterSpinLock(VOID) //------------------------------------------------------------------------- static VOID LeaveSpinLock(VOID) { - MemoryBarrierEx(); InterlockedExchange(&g_isLocked, FALSE); } |