Add gcc implementation for atomic ops

This commit is contained in:
Behdad Esfahbod 2012-06-05 16:06:28 -04:00
parent 0e253e97af
commit d970d2899b
1 changed files with 7 additions and 2 deletions

View File

@ -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 <glib.h>
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