We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac16fbb commit 7aeabe5Copy full SHA for 7aeabe5
src/shims/hw_config.h
@@ -87,7 +87,14 @@ _dispatch_hw_get_config(_dispatch_hw_config_t c)
87
case _dispatch_hw_config_physical_cpus:
88
return sysconf(_SC_NPROCESSORS_CONF);
89
case _dispatch_hw_config_active_cpus:
90
- return sysconf(_SC_NPROCESSORS_ONLN);
+ {
91
+#ifdef __USE_GNU
92
+ cpu_set_t cpuset;
93
+ if (pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset) == 0)
94
+ return CPU_COUNT(&cpuset);
95
+#endif
96
+ return sysconf(_SC_NPROCESSORS_ONLN);
97
+ }
98
}
99
#else
100
const char *name = NULL;
0 commit comments