diff options
Diffstat (limited to 'src/common/spinlock.h')
-rw-r--r-- | src/common/spinlock.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/spinlock.h b/src/common/spinlock.h index 3419bfdd5..9b9e4ce94 100644 --- a/src/common/spinlock.h +++ b/src/common/spinlock.h @@ -52,8 +52,8 @@ static forceinline void FinalizeSpinLock(PSPIN_LOCK lck){ } -#define getsynclock(l) { while(1){ if(InterlockedCompareExchange(l, 1, 0) == 0) break; rathread_yield(); } } -#define dropsynclock(l) { InterlockedExchange(l, 0); } +#define getsynclock(l) do { if(InterlockedCompareExchange((l), 1, 0) == 0) break; rathread_yield(); } while(/*always*/1) +#define dropsynclock(l) do { InterlockedExchange((l), 0); } while(0) static forceinline void EnterSpinLock(PSPIN_LOCK lck){ int tid = rathread_get_tid(); |