summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension/platform.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libdimension/platform.c b/libdimension/platform.c
index b506c10..d93e057 100644
--- a/libdimension/platform.c
+++ b/libdimension/platform.c
@@ -27,6 +27,9 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef _WIN32
+ #include <windows.h>
+#endif
#if DMNSN_BACKTRACE
#include <execinfo.h> /* For backtrace() etc. */
#endif
@@ -95,6 +98,10 @@ dmnsn_ncpus(void)
dmnsn_error(DMNSN_SEVERITY_MEDIUM, "sysconf(_SC_NPROCESSORS_ONLN) failed.");
return 1;
}
+#elif defined(_WIN32)
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return sysinfo.dwNumberOfProcessors;
#else
return 1;
#endif