diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2009-10-19 22:21:00 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2009-10-19 22:28:05 +0800 |
commit | ea39f0302a936711043aa6834ba0ab487736572b (patch) | |
tree | 92059feacb497fc47f2d11efaa427a8358e6b973 | |
parent | a2254e56474fcdf5f25232812cdbef30a2b5ea60 (diff) |
atomic: correct libatomic_ops version of _cairo_atomic_int_cmpxchg
AO_compare_and_swap_full() doesn't have the same semantic as
_cairo_atomic_int_cmpxchg(). The former returns a TRUE on success
FALSE otherwise while the later returns the atomic value.
-rw-r--r-- | src/cairo-atomic-private.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cairo-atomic-private.h b/src/cairo-atomic-private.h index d2583a17..8532f621 100644 --- a/src/cairo-atomic-private.h +++ b/src/cairo-atomic-private.h @@ -91,7 +91,7 @@ typedef AO_t cairo_atomic_int_t; # define _cairo_atomic_int_inc(x) ((void) AO_fetch_and_add1_full(x)) # define _cairo_atomic_int_dec_and_test(x) (AO_fetch_and_sub1_full(x) == 1) -# define _cairo_atomic_int_cmpxchg(x, oldv, newv) ((cairo_atomic_int_t) AO_compare_and_swap_full(x, oldv, newv)) +# define _cairo_atomic_int_cmpxchg(x, oldv, newv) ((cairo_atomic_int_t) AO_compare_and_swap_full(x, oldv, newv) ? oldv : *x) #if SIZEOF_VOID_P==SIZEOF_INT typedef unsigned int cairo_atomic_intptr_t; |