diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-08-31 13:30:01 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-08-31 13:30:01 +0200 |
commit | c90a2c9ea1644507c0993513d1fc7925e19b4ea8 (patch) | |
tree | 41edcd220a914d231118d71c53126b17612bd4f3 /src/threading | |
parent | 37c4373dce60b31ccc0100d85d0013aef82809e7 (diff) | |
download | OFQT-c90a2c9ea1644507c0993513d1fc7925e19b4ea8.tar.gz OFQT-c90a2c9ea1644507c0993513d1fc7925e19b4ea8.zip |
windows implementation for get_core_count()
Diffstat (limited to 'src/threading')
-rw-r--r-- | src/threading/cpu.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/threading/cpu.c b/src/threading/cpu.c index 45671df..381abeb 100644 --- a/src/threading/cpu.c +++ b/src/threading/cpu.c @@ -1,6 +1,17 @@ +#ifdef _WIN32 +#include <windows.h> +#else #include <sys/sysinfo.h> +#endif int get_core_count() { - return get_nprocs(); +#ifdef _WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + + return sysinfo.dwNumberOfProcessors; +#else + return get_nprocs(); +#endif } |