aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2022-08-31 13:30:01 +0200
committerJan200101 <sentrycraft123@gmail.com>2022-08-31 13:30:01 +0200
commitc90a2c9ea1644507c0993513d1fc7925e19b4ea8 (patch)
tree41edcd220a914d231118d71c53126b17612bd4f3
parent37c4373dce60b31ccc0100d85d0013aef82809e7 (diff)
downloadOFQT-c90a2c9ea1644507c0993513d1fc7925e19b4ea8.tar.gz
OFQT-c90a2c9ea1644507c0993513d1fc7925e19b4ea8.zip
windows implementation for get_core_count()
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/threading/cpu.c13
2 files changed, 13 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f3113e0..80a59bb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,8 +6,7 @@ add_subdirectory(vdf)
add_subdirectory(threading)
set(CFLAGS
- -Wall -Wextra -pedantic
- -Wfloat-equal -Wundef
+ -Wall -Wextra -pedantic -Wfloat-equal
-Wstrict-overflow=5 -Wunreachable-code
-Wcast-qual -Wswitch-default
-Wconversion -Wshadow -Wstrict-aliasing
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
}