[libcxx-commits] [libcxx] [libc++][Windows] Enable thread::hardware_concurrency to support more than 64 processors (PR #168229)
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 26 12:51:55 PST 2025
mstorsjo wrote:
> It seems it is guarded by `_WIN32_WINNT >= 0x601` and Android have `_WIN32_WINNT` defined as `0x600`. Is it possible have a check if it is defined to use it else stick to GetSystemInfo?
I see. Well `_WIN32_WINNT` 0x601 is Windows 7 while 0x600 is Vista - our documented required minimum version is Windows 7 (see 80ae168f221526c0f4c9543e861a773214e012cc).
In `support/win32/thread_win32.cpp` we unconditionally use `TryAcquireSRWLockExclusive`, which is available only since Windows 7 (https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-tryacquiresrwlockexclusive) - contrary to most of the other SRW functions that are available since Vista. However I do see that it is incorrectly guarded in https://github.com/mingw-w64/mingw-w64/blob/v13.0.0/mingw-w64-headers/include/synchapi.h#L60-L71 while only requiring `_WIN32_WINNT >= 0x600`.
I would suggest bumping your `_WIN32_WINNT` up to 0x601, as your build hasn't been working on Vista anyway (unless you've been using winpthreads instead of the native win32 threading)?
https://github.com/llvm/llvm-project/pull/168229
More information about the libcxx-commits
mailing list