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
     union 
1302
     union 
1303
     {
1303
     {
1304
       void* addr;
1304
       void* addr;
1305
+#ifdef OS_64
1305
       int64_t   val;
1306
       int64_t   val;
1307
+#else
1308
+      int val;
1309
+#endif
1306
     } u;
1310
     } u;
1307
   } s_t;
1311
   } s_t;
1308
 
1312
 
1310
   
1314
   
1311
   ov.u.addr = old;
1315
   ov.u.addr = old;
1312
   nv.u.addr = neww;
1316
   nv.u.addr = neww;
1313
-
1317
+#ifdef OS_64
1314
   int rv = OSAtomicCompareAndSwap64Barrier(ov.u.val,nv.u.val,(int64_t*)addr);
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
   return rv;
1322
   return rv;
1318
 #endif
1323
 #endif
1319
 
1324
 

Loading…
Cancel
Save