Changeset 6246
- Timestamp:
- 02/21/07 12:16:04
- Files:
-
- OpenThreads/trunk/pthread_src/PThread.c++ (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OpenThreads/trunk/pthread_src/PThread.c++
r6111 r6246 34 34 #include <sched.h> 35 35 #endif 36 #if defined (__APPLE__) 37 #include <CoreServices/CoreServices.h> 36 #if defined (__FreeBSD__) || defined (__APPLE__) || defined (__MACH__) 37 #include <sys/types.h> 38 #include <sys/sysctl.h> 38 39 #endif 39 40 … … 896 897 #if defined(__linux__) 897 898 return sysconf(_SC_NPROCESSORS_CONF); 898 #elif defined(__APPLE__)899 return MPProcessorsScheduled();900 899 #else 901 return 1; 900 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__MACH__) 901 uint64_t num_cpus = 0; 902 size_t num_cpus_length = sizeof(num_cpus); 903 #if defined(__FreeBSD__) 904 sysctlbyname("hw.ncpu", &num_cpus, &num_cpus_length, NULL, 0); 905 #else 906 sysctlbyname("hw.activecpu", &num_cpus, &num_cpus_length, NULL, 0); 907 #endif 908 return num_cpus; 909 #else 910 return 1; 911 #endif 902 912 #endif 903 913 }
