SetThreadIdealProcessorEx
TOC
Collapse the table of content
Expand the table of content

SetThreadIdealProcessorEx function

Sets the ideal processor for the specified thread and optionally retrieves the previous ideal processor.

Syntax


BOOL SetThreadIdealProcessorEx(
  _In_      HANDLE            hThread,
  _In_      PPROCESSOR_NUMBER lpIdealProcessor,
  _Out_opt_ PPROCESSOR_NUMBER lpPreviousIdealProcessor
);

Parameters

hThread [in]

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.

lpIdealProcessor [in]

A pointer to a PROCESSOR_NUMBER structure that specifies the processor number of the desired ideal processor.

lpPreviousIdealProcessor [out, optional]

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.

Return value

If the function succeeds, it returns a nonzero value.

If the function fails, it returns zero. To get extended error information, use GetLastError.

Remarks

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.

Requirements

Minimum supported client

Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1

Header

WinBase.h on Windows 7 and Windows Server 2008 R2 (include Windows.h);
Processthreadsapi.h on Windows 8, Windows Server 2012, and Windows Phone 8.1

Library

Kernel32.lib;
WindowsPhoneCore.lib on Windows Phone 8.1

DLL

Kernel32.dll;
KernelBase.dll on Windows Phone 8.1

See also

GetThreadIdealProcessorEx
SetThreadIdealProcessor

 

 

Show:
© 2016 Microsoft