[glib/gobject-performance-2] Make atomic pointer volatile in GAtomicArray transaction



commit 33f38425fb8577578174fcfe21b0e71bc9edd5b5
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Nov 27 16:43:46 2009 +0100

    Make atomic pointer volatile in GAtomicArray transaction
    
    We need this to ensure the compiler doesn't optimize away the
    end-of-transaction check.

 gobject/gatomicarray.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gobject/gatomicarray.h b/gobject/gatomicarray.h
index d9dfb53..cd084e4 100644
--- a/gobject/gatomicarray.h
+++ b/gobject/gatomicarray.h
@@ -44,7 +44,7 @@ void     g_atomic_array_update (GAtomicArray *array,
 #define  G_ATOMIC_ARRAY_GET_LOCKED(_array, _type) ((_type *)((_array)->data))
 
 #define G_ATOMIC_ARRAY_DO_TRANSACTION(_array, _type, _C_) G_STMT_START {	\
-    gpointer *_datap  = &(_array)->data;					\
+    volatile gpointer *_datap  = &(_array)->data;				\
     _type *transaction_data, *__check;						\
 										\
     __check = g_atomic_pointer_get (_datap);					\



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