This topic has not yet been rated - Rate this topic

SetThreadIdealProcessorEx function

Applies to: desktop apps only

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.

Requirements

Minimum supported client

Windows 7

Minimum supported server

Windows Server 2008 R2

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetThreadIdealProcessorEx
SetThreadIdealProcessor

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ