From a3547330fa88e30a138f6f17e60d9c7d1e316622 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 27 May 2012 10:20:47 -0400 Subject: [PATCH] Cleanup atomic ops on OS X --- src/hb-atomic-private.hh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index ba527739c..458c98496 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -55,10 +55,9 @@ typedef long hb_atomic_int_t; #include typedef int32_t hb_atomic_int_t; -#define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier((V), &(AI)), (AI) - (V)) -#define hb_atomic_int_set(AI, V) \ - do {} while (!OSAtomicCompareAndSwap32 (hb_atomic_int_get (AI), (V), (&(AI)))) -#define hb_atomic_int_get(AI) OSAtomicAdd32Barrier(0, &(AI)) +#define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V)) +#define hb_atomic_int_set(AI, V) ((AI) = (V), OSMemoryBarrier ()) +#define hb_atomic_int_get(AI) (OSMemoryBarrier (), (AI)) #elif !defined(HB_NO_MT) && defined(HAVE_GLIB)