From 0fbd49346691ed755cc3d86ba87029cbec000081 Mon Sep 17 00:00:00 2001 From: BeaR Date: Tue, 2 Apr 2013 16:53:57 +0200 Subject: [PATCH] Fixing atomics --- src/base/tl/threading.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/base/tl/threading.h b/src/base/tl/threading.h index 5caf8588b5..c2bc5abccc 100644 --- a/src/base/tl/threading.h +++ b/src/base/tl/threading.h @@ -7,19 +7,19 @@ atomic_inc - should return the value after increment atomic_dec - should return the value after decrement atomic_compswap - should return the value before the eventual swap - + sync_barrier - creates a full hardware fence */ #if defined(__GNUC__) inline unsigned atomic_inc(volatile unsigned *pValue) { - return __sync_fetch_and_add(pValue, 1); + return __sync_add_and_fetch(pValue, 1); } inline unsigned atomic_dec(volatile unsigned *pValue) { - return __sync_fetch_and_add(pValue, -1); + return __sync_add_and_fetch(pValue, -1); } inline unsigned atomic_compswap(volatile unsigned *pValue, unsigned comperand, unsigned value) @@ -52,7 +52,7 @@ inline void sync_barrier() { - _ReadWriteBarrier(); + _mm_mfence(); } #else #error missing atomic implementation for this compiler