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.<div><br></div><div><div>#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050</div>
<div>#define PetscAtomicCompareandSwap(ptr, oldval, newval) (OSAtomicCompareAndSwapPtr(oldval,newval,ptr))</div><div>#elif defined(_MSC_VER)</div><div>#define PetscAtomicCompareandSwap(ptr, oldval, newval) (InterlockedCompareExchange(ptr,newval,oldval))</div>
<div>#elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100</div><div>#define PetscAtomicCompareandSwap(ptr, oldval, newval) (__sync_bool_compare_and_swap(ptr,oldval,newval))</div><div>#else</div>
<div># error No maping for PetscAtomicCompareandSwap</div><div>#endif</div></div><div><br></div><div><br></div><div>What does everyone else think about using Dave Goodell's Open Portable Atomics (<a href="https://trac.mcs.anl.gov/projects/openpa/">https://trac.mcs.anl.gov/projects/openpa/</a>, used by MPICH2) instead of maintaining our own suite of configuration tests?</div>