[configure] Check for atomic xchg.

Bug 18140 identifies a case where we have an atomic increment, but not an
atomic exchange. We need both to implement atomic reference counting, so
add a second check to detect whether __sync_val_compare_and_swap
generates a non-atomic instruction.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=18140.
This commit is contained in:
Chris Wilson 2008-10-21 09:17:56 +01:00
parent 71e4f7e3a1
commit fd1f3c27e0

View file

@ -101,7 +101,10 @@ AC_DEFUN([CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES],
[
cairo_cv_atomic_primitives="none"
AC_TRY_LINK([int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }], [],
AC_TRY_LINK([
int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }
int atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); }
], [],
cairo_cv_atomic_primitives="Intel"
)
])