瀏覽代碼

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 年之前
父節點
當前提交
cb19fb10a2
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8
    3
      cmThread.c

+ 8
- 3
cmThread.c 查看文件

@@ -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…
取消
儲存