X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fposix%2FOSThreads.c;h=324701d40d84f3a981e8aa67a98a438633fa881e;hb=f50be7e999d666670c4ca0910c8a3065ea2f2411;hp=84b111fcb7404f4795a9b51be19f5b1583352ad3;hpb=5cdb1ff5e889d3361e80e7b01bcb90b682dd9136;p=ghc-hetmet.git diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 84b111f..324701d 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -23,6 +23,11 @@ #include #endif +#if defined(darwin_HOST_OS) +#include +#include +#endif + #if !defined(HAVE_PTHREAD_H) #error pthreads.h is required for the threaded RTS on Posix platforms #endif @@ -202,6 +207,10 @@ 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) + size_t size = sizeof(nat); + if(0 != sysctlbyname("hw.ncpu",&nproc,&size,NULL,0)) + nproc = 1; #else nproc = 1; #endif