summaryrefslogtreecommitdiff
path: root/glib/gatomic.h
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-05-28 00:16:39 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-05-28 00:16:39 -0400
commit00734ef99f2c10bcd25fd85a453712a46d3cf806 (patch)
tree8820c17ec44ffd9d79d7235fb6cd3ec83073f2ae /glib/gatomic.h
parent7cf112225399ffa262082727bf4f434d57568e30 (diff)
downloadglib-00734ef99f2c10bcd25fd85a453712a46d3cf806.tar.gz
Add macro version for all atomic operations
Better to be consistent about this.
Diffstat (limited to 'glib/gatomic.h')
-rw-r--r--glib/gatomic.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/glib/gatomic.h b/glib/gatomic.h
index 9c85607bd..544b6f15e 100644
--- a/glib/gatomic.h
+++ b/glib/gatomic.h
@@ -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)))