diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2014-07-11 12:19:39 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2014-07-11 12:20:24 -0400 |
commit | 6781c6baef062eeea5b5b68e4a9c31ea6cd7539b (patch) | |
tree | 560ec94d4e444b4c32a11689ce0f7f9985cbc8be /src | |
parent | dca5d0feee5eb6428bec48b1aff4396cf92c76c0 (diff) |
Update mingw32 MemoryBarrier from HarfBuzz
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=81228
Diffstat (limited to 'src')
-rw-r--r-- | src/fcatomic.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/fcatomic.h b/src/fcatomic.h index 362e5216..cc28a883 100644 --- a/src/fcatomic.h +++ b/src/fcatomic.h @@ -48,22 +48,22 @@ #include "fcwindows.h" -/* mingw32 does not have MemoryBarrier. - * MemoryBarrier may be defined as a macro or a function. - * Just make a failsafe version for ourselves. */ -#ifdef MemoryBarrier -#define HBMemoryBarrier MemoryBarrier -#else -static inline void HBMemoryBarrier (void) { +/* MinGW has a convoluted history of supporting MemoryBarrier + * properly. As such, define a function to wrap the whole + * thing. */ +static inline void _FCMemoryBarrier (void) { +#if !defined(MemoryBarrier) long dummy = 0; InterlockedExchange (&dummy, 1); -} +#else + MemoryBarrier (); #endif +} typedef LONG fc_atomic_int_t; #define fc_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V)) -#define fc_atomic_ptr_get(P) (HBMemoryBarrier (), (void *) *(P)) +#define fc_atomic_ptr_get(P) (_FCMemoryBarrier (), (void *) *(P)) #define fc_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O)) |