Limit configurable CPU count to the number of detected CPU cores.

This commit is contained in:
Roman D committed 2023-08-21 22:24:13 +02:00
1 parent dfabad37d9
commit 908b8ca0b3
3 files changed
+10 -4

No files matched your search

+5 -1
View File
@@ -1079,12 +1079,16 @@ uint64_t HornerScheme(uint64_t num, uint64_t divider, uint64_t factor) {
return result;
}
// determine number of logical CPU cores (use for multithreaded functions)
int num_CPUs(void) {
if (g_numCPUs > 0) {
return g_numCPUs;
}
return detect_num_CPUs();
}
// determine number of logical CPU cores (use for multithreaded functions)
int detect_num_CPUs(void) {
#if defined(_WIN32)
#include <sysinfoapi.h>
SYSTEM_INFO sysinfo;