From d970d2899b36a2fbd002b224b8bd37b0906fdd5f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 5 Jun 2012 16:06:28 -0400 Subject: [PATCH] Add gcc implementation for atomic ops --- src/hb-atomic-private.hh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index d6bd1c93d..29e4146d8 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -56,10 +56,15 @@ typedef int32_t hb_atomic_int_t; #define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V)) +#elif !defined(HB_NO_MT) && defined(__GNUC__) + +typedef int hb_atomic_int_t; +#define hb_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V)) + #elif !defined(HB_NO_MT) && defined(HAVE_GLIB) #include -typedef volatile int hb_atomic_int_t; +typedef int hb_atomic_int_t; #if GLIB_CHECK_VERSION(2,29,5) #define hb_atomic_int_add(AI, V) g_atomic_int_add (&(AI), (V)) #else @@ -70,7 +75,7 @@ typedef volatile int hb_atomic_int_t; #else #define HB_ATOMIC_INT_NIL 1 -typedef volatile int hb_atomic_int_t; +typedef int hb_atomic_int_t; #define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V)) #endif