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.
This commit is contained in:
parent
5307482f6e
commit
cb19fb10a2
11
cmThread.c
11
cmThread.c
@ -1302,7 +1302,11 @@ bool cmThPtrCAS( void* addr, void* old, void* neww )
|
|||||||
union
|
union
|
||||||
{
|
{
|
||||||
void* addr;
|
void* addr;
|
||||||
|
#ifdef OS_64
|
||||||
int64_t val;
|
int64_t val;
|
||||||
|
#else
|
||||||
|
int val;
|
||||||
|
#endif
|
||||||
} u;
|
} u;
|
||||||
} s_t;
|
} s_t;
|
||||||
|
|
||||||
@ -1310,10 +1314,11 @@ bool cmThPtrCAS( void* addr, void* old, void* neww )
|
|||||||
|
|
||||||
ov.u.addr = old;
|
ov.u.addr = old;
|
||||||
nv.u.addr = neww;
|
nv.u.addr = neww;
|
||||||
|
#ifdef OS_64
|
||||||
int rv = OSAtomicCompareAndSwap64Barrier(ov.u.val,nv.u.val,(int64_t*)addr);
|
int rv = OSAtomicCompareAndSwap64Barrier(ov.u.val,nv.u.val,(int64_t*)addr);
|
||||||
|
#else
|
||||||
//int rv = OSAtomicCompareAndSwapPtrBarrier(old,neww,&addr);
|
int rv = OSAtomicCompareAndSwap32Barrier(ov.u.val,nv.u.val,(int*)addr);
|
||||||
|
#endif
|
||||||
return rv;
|
return rv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user