Changeset 2981 in kBuild
- Timestamp:
- Oct 12, 2016 11:12:58 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/main.c
r2931 r2981 1239 1239 # ifdef WINDOWS32 1240 1240 /* Windows: Count the active CPUs. */ 1241 int cpus, i; 1242 SYSTEM_INFO si; 1243 GetSystemInfo(&si); 1244 for (i = cpus = 0; i < sizeof(si.dwActiveProcessorMask) * 8; i++) 1241 int cpus; 1242 1243 /* Process groups (W7+). */ 1244 typedef DWORD (WINAPI *PFNGETACTIVEPROCESSORCOUNT)(DWORD); 1245 PFNGETACTIVEPROCESSORCOUNT pfnGetActiveProcessorCount; 1246 pfnGetActiveProcessorCount = (PFNGETACTIVEPROCESSORCOUNT)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), 1247 "GetActiveProcessorCount"); 1248 if (pfnGetActiveProcessorCount) 1249 cpus = pfnGetActiveProcessorCount(ALL_PROCESSOR_GROUPS); 1250 /* Legacy (<= Vista). */ 1251 else 1245 1252 { 1246 if (si.dwActiveProcessorMask & 1) 1247 cpus++; 1248 si.dwActiveProcessorMask >>= 1; 1253 int i; 1254 SYSTEM_INFO si; 1255 GetSystemInfo(&si); 1256 for (i = cpus = 0; i < sizeof(si.dwActiveProcessorMask) * 8; i++) 1257 { 1258 if (si.dwActiveProcessorMask & 1) 1259 cpus++; 1260 si.dwActiveProcessorMask >>= 1; 1261 } 1249 1262 } 1250 return cpus ? cpus : 1; 1263 if (!cpus) 1264 cpus = 1; 1265 if (cpus > 64) 1266 cpus = 64; /* (wait for multiple objects limit) */ 1267 return cpus; 1251 1268 1252 1269 # elif defined(__OS2__)
Note:
See TracChangeset
for help on using the changeset viewer.