[glib] [win32] Remove MemoryBarrier() fallback implementation



commit f67a9905ff310b124f91f4d232b785553eafbd2b
Author: Behdad Esfahbod <behdad behdad org>
Date:   Thu Mar 7 20:14:08 2013 -0500

    [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.

 glib/gatomic.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/glib/gatomic.c b/glib/gatomic.c
index 461a8e6..5cba767 100644
--- a/glib/gatomic.c
+++ b/glib/gatomic.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]