diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-12-01 02:01:20 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-12-01 02:01:20 -0500 |
commit | f36e87d366fe4613c657d83c5986ef0b2030b583 (patch) | |
tree | 991119dc1962dc49c1e26b8d3938fc219c34c523 | |
parent | d980f7ffa38d0f455cc24950ba47fd7a353c1074 (diff) | |
download | dimension-f36e87d366fe4613c657d83c5986ef0b2030b583.tar.xz |
Implement dmnsn_ncpus() on Windows.
-rw-r--r-- | libdimension/platform.c | 7 |
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 |