[libcxx] [libc++][Windows] Enable thread::hardware_concurrency to support more… (PR #168229)
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 21 00:56:09 PST 2025
mstorsjo wrote:
> Starting with Windows 11, processes can utilize more than 64 processors by default, but GetSystemInfo can only report a maximum of 64. Starting with Windows Vista, GetActiveProcessorCount accurately retrieves the total number of processors on the current system. I’ve implemented similar improvements to Microsoft STL. The following links contain additional background information: [microsoft/STL#5453](https://github.com/microsoft/STL/issues/5453), [microsoft/STL#5459](https://github.com/microsoft/STL/pull/5459) (note: Reason STL uses the more complex GetLogicalProcessorInformationEx: [microsoft/STL#5459 (comment)](https://github.com/microsoft/STL/pull/5459#discussion_r2072242241).).
Thanks for these links for context, that's appreciated!
For libc++, I'm not sure how many care about being able to target UWP. For llvm-mingw, I do want to support that to some extent - but there, we primarily use the strategy of linking in a static library of stubs for functions that we aren't allowed to call - https://github.com/mingw-w64/mingw-w64/tree/master/mingw-w64-libraries/winstorecompat/src. I think it should be straightforward to add emulation of `GetActiveProcessorCount` there, that just uses the old codepath with `GetSystemInfo`.
Therefore, I think it should be fine to just go with this simple straightforward implementation here.
https://github.com/llvm/llvm-project/pull/168229
More information about the libcxx-commits
mailing list