[llvm] Windows: use EcoQoS for ThreadPriority::Background (PR #148797)

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 06:51:29 PDT 2025


aganea wrote:

This is because `SetThreadInformation` is Windows 8:
```
(in C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\processthreadsapi.h)
...
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
...
WINBASEAPI
BOOL
WINAPI
SetThreadInformation(
    _In_ HANDLE hThread,
    _In_ THREAD_INFORMATION_CLASS ThreadInformationClass,
    _In_reads_bytes_(ThreadInformationSize) LPVOID ThreadInformation,
    _In_ DW
```
However `THREAD_INFORMATION_CLASS` and `THREAD_POWER_THROTTLING_CURRENT_VERSION ` are Windows 10:
```
(in C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\processthreadsapi.h)
...
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10_RS3)

#define THREAD_POWER_THROTTLING_CURRENT_VERSION 1

#define THREAD_POWER_THROTTLING_EXECUTION_SPEED 0x1

#define THREAD_POWER_THROTTLING_VALID_FLAGS (THREAD_POWER_THROTTLING_EXECUTION_SPEED)

typedef struct _THREAD_POWER_THROTTLING_STATE {
    ULONG Version;
    ULONG ControlMask;
    ULONG StateMask;
} THREAD_POWER_THROTTLING_STATE;

#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN10_RS3)
```
MinGW seems to have these unguarded by the Win10 define, but from the errors above it looks like we should somehow include "processthreadsapi.h" explicity for MinGW to build correctly. @mstorsjo I don't have MinGW setup, are you able to confirm this?

https://github.com/llvm/llvm-project/pull/148797


More information about the llvm-commits mailing list