9 #elif defined(__APPLE__) 
   10 #   include <mach/mach.h> 
   11 #   include <mach/machine.h> 
   12 #elif defined(__FreeBSD__) 
   13 #   include <sys/types.h> 
   14 #   include <sys/sysctl.h> 
   25   cpuCount = sysconf(_SC_NPROCESSORS_ONLN);
 
   26 #elif defined(__APPLE__) 
   28   struct host_basic_info hostinfo;
 
   29   mach_msg_type_number_t 
count = HOST_BASIC_INFO_COUNT;
 
   30   kr = host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostinfo, &count);
 
   31   if(kr == KERN_SUCCESS) {
 
   32     cpuCount = hostinfo.avail_cpus;
 
   34 #elif defined( __FreeBSD__) 
   35   cpuCount = sysconf(_SC_NPROCESSORS_ONLN);
 
   38     typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
 
   42     pGNSI = (PGNSI)GetProcAddress(GetModuleHandle(TEXT(
"kernel32.dll")),  
 
   43                                   "GetNativeSystemInfo"); 
 
   50     cpuCount = si.dwNumberOfProcessors;
 
   53   std::cerr << 
"Unknown #cores. Use the default value: " << cpuCount << 
"\n";
 
   57   if (cpuCount > OslConfig::MaxThreads)
 
   58     std::cerr << 
"cpuCount " << cpuCount << 
" > " << 
"MaxThreads " << OslConfig::MaxThreads << 
"\n";
 
   59   return std::min(cpuCount, OslConfig::MaxThreads);