summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-12-26 22:15:29 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-12-26 22:15:29 +0100
commit11bed3b2b78187edb1f5d44fe658eb36c62e676e (patch)
tree1ef214b41b3b0e57a05a1ecf74a861648feebf75
parent0b56957297167538addd330e699e2e3cd2731d68 (diff)
compat/macros: add portable memory barrier
-rw-r--r--compat/macros.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/compat/macros.hpp b/compat/macros.hpp
index 5a2f01e3..8f807bf0 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -5,6 +5,13 @@
#define _(x) otr_tr(x)
#if defined _MSC_VER
+#
+# define MEMORY_BARRIER _ReadWriteBarrier()
+#else
+# define MEMORY_BARRIER asm volatile("" ::: "memory")
+#endif
+
+#if defined _MSC_VER
# define never_inline __declspec(noinline)
#elif defined __GNUG__
# define never_inline __attribute__((noinline))