SetThreadIdealProcessor
SetThreadIdealProcessor sets a preferred processor for a thread.
Syntax
DWORD SetThreadIdealProcessor(
HANDLE hThread,
DWORD dwIdealProcessor
);
Parameters
hThread
A handle to the thread whose preferred processor is to be set.
dwIdealProcessor
The number of the preferred processor for the thread. This value is zero-based.
Return Value
If the function succeeds, it returns the previous preferred processor. If the function fails for an invalid hThread, it returns (DWORD) - 1.
For all the other failing cases. the previous preferred processor is returned.
To get extended error information, call GetLastError.
Remarks
In systems that support load balancing, the ideal processor is the preferred processor for the thread and the system will try to run the thread on the ideal processor when possible. eRTOS does not support load balancing, however. If you set an ideal processor for a thread, that is the processor the thread will run on.
You can use the GetProcessAffinityMask function to check the processors on which the thread is allowed to run. Note that GetProcessAffinityMask returns a bit mask whereas SetThreadIdealProcessor uses an integer value to represent the processor.
To compile an application that uses this function, define _WIN32_WINNT as shown in the table below. For more information, see the Windows MSDN documentation.
Windows Version | Minimum Value for _WIN32_WINNT |
---|---|
Windows 10 | 0x0A00 |
Requirements
Minimum supported version | Header | Library |
---|---|---|
eRTOS 1.0 SDK |
windows.h | rtkrnl.lib |
See Also: