Browse Source

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.
master
kevin 11 years ago
parent
commit
cb19fb10a2
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      cmThread.c

+ 8
- 3
cmThread.c View File

@@ -1302,7 +1302,11 @@ bool     cmThPtrCAS(   void*    addr, void*    old, void*    neww )
1302 1302
     union 
1303 1303
     {
1304 1304
       void* addr;
1305
+#ifdef OS_64
1305 1306
       int64_t   val;
1307
+#else
1308
+      int val;
1309
+#endif
1306 1310
     } u;
1307 1311
   } s_t;
1308 1312
 
@@ -1310,10 +1314,11 @@ bool     cmThPtrCAS(   void*    addr, void*    old, void*    neww )
1310 1314
   
1311 1315
   ov.u.addr = old;
1312 1316
   nv.u.addr = neww;
1313
-
1317
+#ifdef OS_64
1314 1318
   int rv = OSAtomicCompareAndSwap64Barrier(ov.u.val,nv.u.val,(int64_t*)addr);
1315
-  
1316
-  //int rv = OSAtomicCompareAndSwapPtrBarrier(old,neww,&addr);
1319
+#else
1320
+  int rv = OSAtomicCompareAndSwap32Barrier(ov.u.val,nv.u.val,(int*)addr);
1321
+#endif
1317 1322
   return rv;
1318 1323
 #endif
1319 1324
 

Loading…
Cancel
Save