summaryrefslogtreecommitdiff
path: root/src/til_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/til_util.c')
-rw-r--r--src/til_util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/til_util.c b/src/til_util.c
index dd2fca2..e91f9d6 100644
--- a/src/til_util.c
+++ b/src/til_util.c
@@ -15,7 +15,7 @@
#include "til_util.h"
#define TIL_SYSFS_CPU "/sys/devices/system/cpu/cpu"
-#define TIL_MAXCPUS 1024
+#define TIL_MAXCPUS 1024
unsigned til_get_ncpus(void)
{
@@ -24,7 +24,7 @@ unsigned til_get_ncpus(void)
GetSystemInfo(&sysinfo);
- return sysinfo.dwNumberOfProcessors;
+ return MIN(sysinfo.dwNumberOfProcessors, TIL_MAXCPUS);
#endif
#ifdef __MACH__
@@ -34,7 +34,7 @@ unsigned til_get_ncpus(void)
if (sysctlbyname("hw.logicalcpu_max", &count, &count_len, NULL, 0) < 0)
return 1;
- return count;
+ return MIN(count, TIL_MAXCPUS);
#else
char path[cstrlen(TIL_SYSFS_CPU "1024") + 1];
unsigned n;
© All Rights Reserved