Sets the ideal processor for the specified thread and optionally retrieves the previous ideal processor.
BOOL SetThreadIdealProcessorEx( HANDLE hThread, PPROCESSOR_NUMBER lpIdealProcessor, PPROCESSOR_NUMBER lpPreviousIdealProcessor );
A handle to the thread for which to set the ideal processor. This handle must have been created with the THREAD_SET_INFORMATION access right. For more information, see Thread Security and Access Rights.
A pointer to a PROCESSOR_NUMBER structure that specifies the processor number of the desired ideal processor.
A pointer to a PROCESSOR_NUMBER structure to receive the previous ideal processor. This parameter can point to the same memory location as the lpIdealProcessor parameter. This parameter can be NULL if the previous ideal processor is not required.
If the function succeeds, it returns a nonzero value.
If the function fails, it returns zero. To get extended error information, use GetLastError.
Specifying a thread ideal processor provides a hint to the scheduler about the preferred processor for a thread. The scheduler runs the thread on the thread's ideal processor when possible.
To compile an application that uses this function, set _WIN32_WINNT >= 0x0601. For more information, see Using the Windows Headers.
Windows Phone 8.1: This function is supported for Windows Phone Store apps on Windows Phone 8.1 and later.
Windows 8.1 and Windows Server 2012 R2: This function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.
|Windows version||Windows 7 [desktop apps | UWP apps] Windows Server 2008 R2 [desktop apps | UWP apps]|
|Header||processthreadsapi.h (include Windows.h)|
|Library||Kernel32.lib; WindowsPhoneCore.lib on Windows Phone 8.1|
|DLL||Kernel32.dll; KernelBase.dll on Windows Phone 8.1|