[llvm] Windows: use EcoQoS for ThreadPriority::Background (PR #148797)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 30 12:52:17 PDT 2025
mstorsjo wrote:
> This is because `SetThreadInformation` is Windows 8:
>
>
> However `THREAD_INFORMATION_CLASS` and `THREAD_POWER_THROTTLING_CURRENT_VERSION ` are Windows 10:
>
>
> [MinGW seems to have these](https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/include/processthreadsapi.h#L346) unguarded by the Win10 define, but from the errors above it looks like we should somehow `#include "processthreadsapi.h"` explicity in `llvm/lib/Support/Windows/Threading.inc` for MinGW to build correctly. @mstorsjo I don't have a MinGW setup, are you able to confirm this?
No, you're drawing the wrong conclusions here.
Yes, in the MS WinSDK, `THREAD_INFORMATION_CLASS` and `THREAD_POWER_THROTTLING_CURRENT_VERSION` require targeting Windows 10. If you'd build with MS WinSDK targeting a lower version of Windows, you'd run into the same error messages there.
In mingw headers, these declarations don't have the Windows target version checks - so as long as `processthreadsapi.h` gets included, they should be available. And these files do build fine for me, with mingw-w64 - `processthreadsapi.h` does get implicitly included by `windows.h` somewhere. It's just that if you have an older version of mingw-w64 headers, like I presume @Sharjeel-Khan does, then you run into this error.
So in order to fix building with both WinSDK targeting older versions of Windows, and older mingw-w64, we'd need to add an ifdef like what I'm suggesting. (Or manually duplicate the definition of these types.)
https://github.com/llvm/llvm-project/pull/148797
More information about the llvm-commits
mailing list