Lots of other compilers support GCC-style intrinsics like __sync_bool_compare_and_swap() and similar, so we really can't be doing this kind of logic in lockfree.c.
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 #define PetscAtomicCompareandSwap(ptr, oldval, newval) (OSAtomicCompareAndSwapPtr(oldval,newval,ptr)) #elif defined(_MSC_VER) #define PetscAtomicCompareandSwap(ptr, oldval, newval) (InterlockedCompareExchange(ptr,newval,oldval)) #elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 #define PetscAtomicCompareandSwap(ptr, oldval, newval) (__sync_bool_compare_and_swap(ptr,oldval,newval)) #else # error No maping for PetscAtomicCompareandSwap #endif What does everyone else think about using Dave Goodell's Open Portable Atomics (https://trac.mcs.anl.gov/projects/openpa/, used by MPICH2) instead of maintaining our own suite of configuration tests? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120414/d17f363e/attachment.html>
