Expand Minimize
This topic has not yet been rated - Rate this topic

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.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

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

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetThreadIdealProcessorEx
SetThreadIdealProcessor

 

 

Send comments about this topic to Microsoft

Build date: 11/21/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.