diff options
Diffstat (limited to 'fontconfig/src/fcatomic.h')
-rw-r--r-- | fontconfig/src/fcatomic.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fontconfig/src/fcatomic.h b/fontconfig/src/fcatomic.h index 362e52164..cc28a883c 100644 --- a/fontconfig/src/fcatomic.h +++ b/fontconfig/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)) |