summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-11-21 15:48:28 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-11-21 15:50:57 -0800
commit63405ab723eada97a195ed1964ca3af78aa5d7da (patch)
treefdcc3a7d9f734accaef58f2cef751f4d7d32e591
parent36f35fa226d028533f64e49eafbdcd829b1d7ec1 (diff)
til_util: fix til_get_ncpus() windows builds
Prior to eb13ccdb (use sysconf on *nix) this #ifdef bug went unnoticed because the non-MACH code still compiled successfully on windows, just never got executed because the windows block returns. But after eb13ccdb the sysconf stuff needs defines not present for windows and things won't build, uncovering this silliness. Now only build the windows code on windows, and the non-win code everywhere else... with MACH being a special case of the everywhere else default.
-rw-r--r--src/til_util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/til_util.c b/src/til_util.c
index 7c44d67..d2e5b92 100644
--- a/src/til_util.c
+++ b/src/til_util.c
@@ -25,9 +25,8 @@ unsigned til_get_ncpus(void)
GetSystemInfo(&sysinfo);
return MIN(sysinfo.dwNumberOfProcessors, TIL_MAXCPUS);
-#endif
-
-#ifdef __MACH__
+#else
+ #ifdef __MACH__
int count;
size_t count_len = sizeof(count);
@@ -35,7 +34,7 @@ unsigned til_get_ncpus(void)
return 1;
return MIN(count, TIL_MAXCPUS);
-#else
+ #else
long n;
n = sysconf(_SC_NPROCESSORS_ONLN);
@@ -43,5 +42,6 @@ unsigned til_get_ncpus(void)
return 1;
return MIN(n, TIL_MAXCPUS);
+ #endif
#endif
}
© All Rights Reserved