summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-29 00:52:05 -0800
committerPixel <pixel@nobis-crew.org>2011-11-29 00:52:05 -0800
commitd4c4ee9aa1fdd216e46d13e3a65f26d05d1d528b (patch)
tree5fcbd11fe7f7c53527d53e8c7561045112534551
parentce6bdf0537660a59cac017a2d58d703468f33298 (diff)
Adding memory fences to Atomic.h; won't hurt that much...
-rw-r--r--includes/Atomic.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/includes/Atomic.h b/includes/Atomic.h
index b31c26d..d084d31 100644
--- a/includes/Atomic.h
+++ b/includes/Atomic.h
@@ -25,6 +25,8 @@ template <class T> T Decrement(volatile T * ptr, T delta = 1) { return __sync_fe
template <class T> T CmpXChgVal(volatile T * ptr, const T xch, const T cmp) { return __sync_val_compare_and_swap(ptr, cmp, xch); }
template <class T> bool CmpXChgBool(volatile T * ptr, const T xch, const T cmp) { return __sync_bool_compare_and_swap(ptr, cmp, xch); }
+static inline void MemoryFence() { __sync_synchronize(); }
+
template <class T> T Exchange32(volatile T * ptr, const T exchange) {
#if defined(i386) || defined (__x86_64)
__asm__ __volatile__("lock xchgl %0, (%1)" : "+r"(exchange) : "r"(ptr));