aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Lankhorst2015-02-26 04:54:01 -0600
committerMaarten Lankhorst2015-03-13 14:21:00 -0500
commitcd4685498b7926cf3fb39c6d0d25b2bc76c29f68 (patch)
tree44c4af1050df3171ce997ab8d568743914d054a6 /xf86atomic.h
parentf7b0586f164f3157fae228c5e413a38d1650cada (diff)
downloadexternal-libdrm-cd4685498b7926cf3fb39c6d0d25b2bc76c29f68.tar.gz
external-libdrm-cd4685498b7926cf3fb39c6d0d25b2bc76c29f68.tar.xz
external-libdrm-cd4685498b7926cf3fb39c6d0d25b2bc76c29f68.zip
Add atomic_inc_return to atomics.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com> Acked-By: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'xf86atomic.h')
-rw-r--r--xf86atomic.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/xf86atomic.h b/xf86atomic.h
index 8c4b696a..17fb088d 100644
--- a/xf86atomic.h
+++ b/xf86atomic.h
@@ -49,6 +49,7 @@ typedef struct {
49# define atomic_read(x) ((x)->atomic) 49# define atomic_read(x) ((x)->atomic)
50# define atomic_set(x, val) ((x)->atomic = (val)) 50# define atomic_set(x, val) ((x)->atomic = (val))
51# define atomic_inc(x) ((void) __sync_fetch_and_add (&(x)->atomic, 1)) 51# define atomic_inc(x) ((void) __sync_fetch_and_add (&(x)->atomic, 1))
52# define atomic_inc_return(x) (__sync_add_and_fetch (&(x)->atomic, 1))
52# define atomic_dec_and_test(x) (__sync_fetch_and_add (&(x)->atomic, -1) == 1) 53# define atomic_dec_and_test(x) (__sync_fetch_and_add (&(x)->atomic, -1) == 1)
53# define atomic_add(x, v) ((void) __sync_add_and_fetch(&(x)->atomic, (v))) 54# define atomic_add(x, v) ((void) __sync_add_and_fetch(&(x)->atomic, (v)))
54# define atomic_dec(x, v) ((void) __sync_sub_and_fetch(&(x)->atomic, (v))) 55# define atomic_dec(x, v) ((void) __sync_sub_and_fetch(&(x)->atomic, (v)))
@@ -68,6 +69,7 @@ typedef struct {
68# define atomic_read(x) AO_load_full(&(x)->atomic) 69# define atomic_read(x) AO_load_full(&(x)->atomic)
69# define atomic_set(x, val) AO_store_full(&(x)->atomic, (val)) 70# define atomic_set(x, val) AO_store_full(&(x)->atomic, (val))
70# define atomic_inc(x) ((void) AO_fetch_and_add1_full(&(x)->atomic)) 71# define atomic_inc(x) ((void) AO_fetch_and_add1_full(&(x)->atomic))
72# define atomic_inc_return(x) (AO_fetch_and_add1_full(&(x)->atomic) + 1)
71# define atomic_add(x, v) ((void) AO_fetch_and_add_full(&(x)->atomic, (v))) 73# define atomic_add(x, v) ((void) AO_fetch_and_add_full(&(x)->atomic, (v)))
72# define atomic_dec(x, v) ((void) AO_fetch_and_add_full(&(x)->atomic, -(v))) 74# define atomic_dec(x, v) ((void) AO_fetch_and_add_full(&(x)->atomic, -(v)))
73# define atomic_dec_and_test(x) (AO_fetch_and_sub1_full(&(x)->atomic) == 1) 75# define atomic_dec_and_test(x) (AO_fetch_and_sub1_full(&(x)->atomic) == 1)
@@ -91,6 +93,7 @@ typedef struct { LIBDRM_ATOMIC_TYPE atomic; } atomic_t;
91# define atomic_read(x) (int) ((x)->atomic) 93# define atomic_read(x) (int) ((x)->atomic)
92# define atomic_set(x, val) ((x)->atomic = (LIBDRM_ATOMIC_TYPE)(val)) 94# define atomic_set(x, val) ((x)->atomic = (LIBDRM_ATOMIC_TYPE)(val))
93# define atomic_inc(x) (atomic_inc_uint (&(x)->atomic)) 95# define atomic_inc(x) (atomic_inc_uint (&(x)->atomic))
96# define atomic_inc_return (atomic_inc_uint_nv(&(x)->atomic))
94# define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 0) 97# define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 0)
95# define atomic_add(x, v) (atomic_add_int(&(x)->atomic, (v))) 98# define atomic_add(x, v) (atomic_add_int(&(x)->atomic, (v)))
96# define atomic_dec(x, v) (atomic_add_int(&(x)->atomic, -(v))) 99# define atomic_dec(x, v) (atomic_add_int(&(x)->atomic, -(v)))