From cb19fb10a23166457f218cfe86ce6bb0eb96643e Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 16 Oct 2013 08:58:46 -0700 Subject: [PATCH] cmThread.c : Changed cmThPtrCAS() to select the CAS system call based on OS_64 when compiling under OSX. This allows backward compatibility with older version of OSX. --- cmThread.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmThread.c b/cmThread.c index 17d1b89..18c5f0b 100644 --- a/cmThread.c +++ b/cmThread.c @@ -1302,7 +1302,11 @@ bool cmThPtrCAS( void* addr, void* old, void* neww ) union { void* addr; +#ifdef OS_64 int64_t val; +#else + int val; +#endif } u; } s_t; @@ -1310,10 +1314,11 @@ bool cmThPtrCAS( void* addr, void* old, void* neww ) ov.u.addr = old; nv.u.addr = neww; - +#ifdef OS_64 int rv = OSAtomicCompareAndSwap64Barrier(ov.u.val,nv.u.val,(int64_t*)addr); - - //int rv = OSAtomicCompareAndSwapPtrBarrier(old,neww,&addr); +#else + int rv = OSAtomicCompareAndSwap32Barrier(ov.u.val,nv.u.val,(int*)addr); +#endif return rv; #endif