diff options
author | Eugene Akentyev <ak3ntev@gmail.com> | 2016-04-07 03:44:59 +0000 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2016-04-07 03:47:34 +0000 |
commit | eda273bc0be4f2316758e121f5f0ed85c3460c7f (patch) | |
tree | 5d0d697862810f894e425db635d9757a3fdef260 /rts/posix | |
parent | c9e8f801170b213b85735ed403f24b2842aedf1b (diff) | |
download | haskell-eda273bc0be4f2316758e121f5f0ed85c3460c7f.tar.gz |
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
Diffstat (limited to 'rts/posix')
-rw-r--r-- | rts/posix/OSThreads.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 91f95237ae..1562ee49d7 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -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; |