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
The previous preferred processor if the function succeeds, (DWORD) - 1 if the function fails for an invalid hThread
The previous preferred processor is returned for all the other failing cases
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. RTX does not support load balancing, however, so 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 7 | 0x0601 |
Requirements
Minimum Supported Version | RTX64 2013 |
Header | windows.h |
Library | Rtx_Rtss.lib |
See Also: