[libcxx-commits] [libcxx] [libc++] Fixed get count threads multi-CPU system with NUMA architecture (#72267) (PR #72270)
Alexandre Ganea via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 16 08:03:09 PST 2023
================
@@ -81,9 +81,43 @@ thread::hardware_concurrency() noexcept
return 0;
return static_cast<unsigned>(result);
#elif defined(_LIBCPP_WIN32API)
+ // This implementation supports both conventional single-cpu PC configurations
+ // and multi-cpu system on NUMA (Non-uniform_memory_access) architecture
+ DWORD length = 0;
----------------
aganea wrote:
Why not move all this Win32-specific code in `libcxx/src/support/win32/thread_win32.cpp (see other comments)
Also move everything in a lambda that is executed only once with a local static, i.e
```
unsigned __libcpp_hardware_concurrency()
{
static unsigned hardware_threads = []() { ... };
}
```
https://github.com/llvm/llvm-project/pull/72270
More information about the libcxx-commits
mailing list