提交 12f5c0a2 编写于 作者: B Behdad Esfahbod

Fix check for Intel atomic ops

上级 6932a41f
...@@ -182,11 +182,12 @@ dnl =========================================================================== ...@@ -182,11 +182,12 @@ dnl ===========================================================================
AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [ AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
hb_cv_have_intel_atomic_primitives=false hb_cv_have_intel_atomic_primitives=false
AC_TRY_LINK([], [ AC_TRY_LINK([
void memory_barrier (void) { __sync_synchronize (); } void memory_barrier (void) { __sync_synchronize (); }
int atomic_add (int i) { return __sync_fetch_and_add (&i, 1); } 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); } int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
], hb_cv_have_intel_atomic_primitives=true void mutex_unlock (int *m) { __sync_lock_release (m); }
], [], hb_cv_have_intel_atomic_primitives=true
) )
]) ])
if $hb_cv_have_intel_atomic_primitives; then if $hb_cv_have_intel_atomic_primitives; then
......
...@@ -65,7 +65,7 @@ typedef int32_t hb_atomic_int_t; ...@@ -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)) #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; typedef int hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V)) #define hb_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册