Browse Source

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

reason for the conditional compilation.
master
kevin 11 years ago
parent
commit
544fe4acc4
1 changed files with 9 additions and 10 deletions
  1. 9
    10
      cmThread.c

+ 9
- 10
cmThread.c View File

1072
 #endif
1072
 #endif
1073
 }
1073
 }
1074
 
1074
 
1075
-#define OS_VER_10_6
1076
 
1075
 
1077
 bool     cmThPtrCAS(   void*    addr, void*    old, void*    neww )
1076
 bool     cmThPtrCAS(   void*    addr, void*    old, void*    neww )
1078
 {
1077
 {
1086
     union 
1085
     union 
1087
     {
1086
     {
1088
       void* addr;
1087
       void* addr;
1089
-#ifdef OS_VER_10_6
1090
-      int64_t   val;
1091
-#else
1088
+#ifdef OSX_VER_10_5
1092
       int val;
1089
       int val;
1090
+#else
1091
+      int64_t   val;
1093
 #endif
1092
 #endif
1094
     } u;
1093
     } u;
1095
   } s_t;
1094
   } s_t;
1098
   
1097
   
1099
   ov.u.addr = old;
1098
   ov.u.addr = old;
1100
   nv.u.addr = neww;
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
   int rv = OSAtomicCompareAndSwap32Barrier(ov.u.val,nv.u.val,(int*)addr);
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
 #endif
1104
 #endif
1106
   return rv;
1105
   return rv;
1107
 #endif
1106
 #endif
1108
 
1107
 
1109
 #ifdef OS_LINUX
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
   return  __sync_bool_compare_and_swap((int*)addr,(int)old,(int)neww); 
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
 #endif
1113
 #endif
1115
 #endif
1114
 #endif
1116
 }
1115
 }

Loading…
Cancel
Save