提交 fbb2847f 编写于 作者: B Behdad Esfahbod

Improve MemoryBarrier() implementation

See thread "[HarfBuzz] compilation error of 0.9.26 with MinGW"
started by Werner.
上级 189bf23b
......@@ -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))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册