[win32] Remove MemoryBarrier() fallback implementation
I added these because the older mingw32 toolchain didn't have MemoryBarrier(). The newer mingw-w64 toolchain however has. As reported by John Emmas this was causing build failure with MSVC (on glib) because of inline issues. But that reminded me that we may be taking this path even if the system implements MemoryBarrier as a function, which is a waste. So, just remove it.
This commit is contained in:
parent
ea11abfc5d
commit
2761e8a632
|
@ -47,22 +47,10 @@
|
|||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.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) {
|
||||
long dummy = 0;
|
||||
InterlockedExchange (&dummy, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef LONG hb_atomic_int_t;
|
||||
#define hb_atomic_int_add(AI, V) InterlockedExchangeAdd (&(AI), (V))
|
||||
|
||||
#define hb_atomic_ptr_get(P) (HBMemoryBarrier (), (void *) *(P))
|
||||
#define hb_atomic_ptr_get(P) (MemoryBarrier (), (void *) *(P))
|
||||
#define hb_atomic_ptr_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue