[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 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:
Behdad Esfahbod 2013-03-07 20:14:08 -05:00
parent 75d424977e
commit f67a9905ff

View File

@ -523,25 +523,13 @@ _gInterlockedXor (volatile guint *atomic,
#define InterlockedXor(a,b) _gInterlockedXor(a,b)
#endif
/* 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 _GMemoryBarrier MemoryBarrier
#else
static inline void _GMemoryBarrier (void) {
long dummy = 0;
InterlockedExchange (&dummy, 1);
}
#endif
/*
* http://msdn.microsoft.com/en-us/library/ms684122(v=vs.85).aspx
*/
gint
(g_atomic_int_get) (const volatile gint *atomic)
{
_GMemoryBarrier ();
MemoryBarrier ();
return *atomic;
}
@ -550,7 +538,7 @@ void
gint newval)
{
*atomic = newval;
_GMemoryBarrier ();
MemoryBarrier ();
}
void
@ -607,7 +595,7 @@ gpointer
{
const volatile gpointer *ptr = atomic;
_GMemoryBarrier ();
MemoryBarrier ();
return *ptr;
}
@ -618,7 +606,7 @@ void
volatile gpointer *ptr = atomic;
*ptr = newval;
_GMemoryBarrier ();
MemoryBarrier ();
}
gboolean