Fix check for Intel atomic ops

This commit is contained in:
Behdad Esfahbod 2012-06-26 11:16:13 -04:00
parent 6932a41fb6
commit 12f5c0a222
2 changed files with 6 additions and 5 deletions

View File

@ -182,11 +182,12 @@ dnl ===========================================================================
AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
hb_cv_have_intel_atomic_primitives=false
AC_TRY_LINK([], [
AC_TRY_LINK([
void memory_barrier (void) { __sync_synchronize (); }
int atomic_add (int i) { return __sync_fetch_and_add (&i, 1); }
int atomic_cmpxchg (int *i, int *j, int *k) { return __sync_bool_compare_and_swap (&i, j, k); }
], hb_cv_have_intel_atomic_primitives=true
int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
void mutex_unlock (int *m) { __sync_lock_release (m); }
], [], hb_cv_have_intel_atomic_primitives=true
)
])
if $hb_cv_have_intel_atomic_primitives; then

View File

@ -65,7 +65,7 @@ typedef int32_t hb_atomic_int_t;
#define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) && !defined(__MINGW32__)
#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
typedef int hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V))