瀏覽代碼

cmThread.c : Changed OS_VER_10_6 TO OSX_VER_10_5 to better reflect the

reason for the conditional compilation.
master
kevin 11 年之前
父節點
當前提交
544fe4acc4
共有 1 個文件被更改,包括 9 次插入10 次删除
  1. 9
    10
      cmThread.c

+ 9
- 10
cmThread.c 查看文件

@@ -1072,7 +1072,6 @@ bool     cmThFloatCAS( float*    addr, float    old, float    new )
1072 1072
 #endif
1073 1073
 }
1074 1074
 
1075
-#define OS_VER_10_6
1076 1075
 
1077 1076
 bool     cmThPtrCAS(   void*    addr, void*    old, void*    neww )
1078 1077
 {
@@ -1086,10 +1085,10 @@ bool     cmThPtrCAS(   void*    addr, void*    old, void*    neww )
1086 1085
     union 
1087 1086
     {
1088 1087
       void* addr;
1089
-#ifdef OS_VER_10_6
1090
-      int64_t   val;
1091
-#else
1088
+#ifdef OSX_VER_10_5
1092 1089
       int val;
1090
+#else
1091
+      int64_t   val;
1093 1092
 #endif
1094 1093
     } u;
1095 1094
   } s_t;
@@ -1098,19 +1097,19 @@ bool     cmThPtrCAS(   void*    addr, void*    old, void*    neww )
1098 1097
   
1099 1098
   ov.u.addr = old;
1100 1099
   nv.u.addr = neww;
1101
-#ifdef OS_VER_10_6
1102
-  int rv = OSAtomicCompareAndSwap64Barrier(ov.u.val,nv.u.val,(int64_t*)addr);
1103
-#else
1100
+#ifdef OSX_VER_10_5
1104 1101
   int rv = OSAtomicCompareAndSwap32Barrier(ov.u.val,nv.u.val,(int*)addr);
1102
+#else
1103
+  int rv = OSAtomicCompareAndSwap64Barrier(ov.u.val,nv.u.val,(int64_t*)addr);
1105 1104
 #endif
1106 1105
   return rv;
1107 1106
 #endif
1108 1107
 
1109 1108
 #ifdef OS_LINUX
1110
-#ifdef OS_VER_10_6
1111
-  return  __sync_bool_compare_and_swap((long long*)addr, (long long)old, (long long)neww); 
1112
-#else
1109
+#ifdef OSX_VER_10_5
1113 1110
   return  __sync_bool_compare_and_swap((int*)addr,(int)old,(int)neww); 
1111
+#else
1112
+  return  __sync_bool_compare_and_swap((long long*)addr, (long long)old, (long long)neww); 
1114 1113
 #endif
1115 1114
 #endif
1116 1115
 }

Loading…
取消
儲存