[HarfBuzz] harfbuzz: Branch 'master'
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed Feb 5 14:22:43 CET 2014
src/hb-atomic-private.hh | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
New commits:
commit fbb2847f541389f40718af71c4945024ae177ab2
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Feb 5 08:22:06 2014 -0500
Improve MemoryBarrier() implementation
See thread "[HarfBuzz] compilation error of 0.9.26 with MinGW"
started by Werner.
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index b5d6485..1c4e120 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -47,18 +47,22 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#if defined(__MINGW32__) && !defined(MemoryBarrier)
+/* MinGW has a convoluted history of supporting MemoryBarrier
+ * properly. As such, define a function to wrap the whole
+ * thing. */
static inline void _HBMemoryBarrier (void) {
+#if !defined(MemoryBarrier)
long dummy = 0;
InterlockedExchange (&dummy, 1);
-}
-# define MemoryBarrier _HBMemoryBarrier
+#else
+ MemoryBarrier ();
#endif
+}
typedef LONG hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V))
-#define hb_atomic_ptr_get(P) (MemoryBarrier (), (void *) *(P))
+#define hb_atomic_ptr_get(P) (_HBMemoryBarrier (), (void *) *(P))
#define hb_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
More information about the HarfBuzz
mailing list