Commit eda273bc authored by Eugene Akentyev's avatar Eugene Akentyev Committed by Austin Seipp

runtime: replace hw.ncpu with hw.logicalcpu for Mac OS X

Reviewed By: erikd, austin

Differential Revision: https://phabricator.haskell.org/D2082

GHC Trac Issues: #8594
parent c9e8f801
......@@ -237,9 +237,15 @@ getNumberOfProcessors (void)
nproc = sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF)
nproc = sysconf(_SC_NPROCESSORS_CONF);
#elif defined(darwin_HOST_OS) || defined(freebsd_HOST_OS)
#elif defined(darwin_HOST_OS)
size_t size = sizeof(nat);
if(0 != sysctlbyname("hw.ncpu",&nproc,&size,NULL,0))
if(sysctlbyname("hw.logicalcpu",&nproc,&size,NULL,0) != 0) {
if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0)
nproc = 1;
}
#elif defined(freebsd_HOST_OS)
size_t size = sizeof(nat);
if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0)
nproc = 1;
#else
nproc = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment