aboutsummaryrefslogtreecommitdiff
path: root/src/threading
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 /src/threading
parent37c4373dce60b31ccc0100d85d0013aef82809e7 (diff)
downloadOFQT-c90a2c9ea1644507c0993513d1fc7925e19b4ea8.tar.gz
OFQT-c90a2c9ea1644507c0993513d1fc7925e19b4ea8.zip
windows implementation for get_core_count()
Diffstat (limited to 'src/threading')
-rw-r--r--src/threading/cpu.c13
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
}