[win32] Remove MemoryBarrier() fallback implementation
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 8 Mar 2013 01:14:08 +0000 (20:14 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 8 Mar 2013 01:21:12 +0000 (20:21 -0500)
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.

glib/gatomic.c

index 461a8e6..5cba767 100644 (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