Add macro version for all atomic operations
authorMatthias Clasen <mclasen@redhat.com>
Sat, 28 May 2011 04:16:39 +0000 (00:16 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 28 May 2011 04:16:39 +0000 (00:16 -0400)
Better to be consistent about this.

glib/gatomic.h

index 9c85607bd7ad7284955e52890b4d1fb69348eb35..544b6f15e5a57a6b7b24fb57793db493c2dee386 100644 (file)
@@ -99,16 +99,28 @@ void     g_atomic_pointer_set                  (volatile gpointer G_GNUC_MAY_ALI
 
 #else
 
-# define g_atomic_int_get(atomic) \
+#define g_atomic_int_exchange_and_add(atomic,val) \
+ (G_STATIC_ASSERT_EXPR(sizeof (*(atomic)) == sizeof (gint)), \
+  (g_atomic_int_exchange_and_add) ((volatile gint G_GNUC_MAY_ALIAS *) (volatile void *) (atomic), (val)))
+#define g_atomic_int_add(atomic,val) \
+ (G_STATIC_ASSERT_EXPR(sizeof (*(atomic)) == sizeof (gint)), \
+  (g_atomic_int_add) ((volatile gint G_GNUC_MAY_ALIAS *) (volatile void *) (atomic), (val)))
+#define g_atomic_int_compare_and_exchange(atomic,oldval,newval) \
+ (G_STATIC_ASSERT_EXPR(sizeof (*(atomic)) == sizeof (gint)), \
+  (g_atomic_int_compare_and_exchange) ((volatile gint G_GNUC_MAY_ALIAS *) (volatile void *) (atomic), (oldval), (newval)))
+#define g_atomic_pointer_compare_and_exchange(atomic,oldval,newval) \
+ (G_STATIC_ASSERT_EXPR(sizeof (*(atomic)) == sizeof (gpointer)), \
+  (g_atomic_pointer_compare_and_exchange) ((volatile gpointer G_GNUC_MAY_ALIAS *) (volatile void *) (atomic), (oldval), (newval)))
+#define g_atomic_int_get(atomic) \
  (G_STATIC_ASSERT_EXPR(sizeof (*(atomic)) == sizeof (gint)), \
   (g_atomic_int_get) ((volatile gint G_GNUC_MAY_ALIAS *) (volatile void *) (atomic)))
-# define g_atomic_int_set(atomic, newval) \
+#define g_atomic_int_set(atomic, newval) \
  (G_STATIC_ASSERT_EXPR(sizeof (*(atomic)) == sizeof (gint)), \
   (g_atomic_int_set) ((volatile gint G_GNUC_MAY_ALIAS *) (volatile void *) (atomic), (newval)))
-# define g_atomic_pointer_get(atomic) \
+#define g_atomic_pointer_get(atomic) \
  (G_STATIC_ASSERT_EXPR(sizeof (*(atomic)) == sizeof (gpointer)), \
   (g_atomic_pointer_get) ((volatile gpointer G_GNUC_MAY_ALIAS *) (volatile void *) (atomic)))
-# define g_atomic_pointer_set(atomic, newval) \
+#define g_atomic_pointer_set(atomic, newval) \
  (G_STATIC_ASSERT_EXPR(sizeof (*(atomic)) == sizeof (gpointer)), \
   (g_atomic_pointer_set) ((volatile gpointer G_GNUC_MAY_ALIAS *) (volatile void *) (atomic), (newval)))