Partager via


CeSetThreadAffinity (Compact 2013)

3/28/2014

This function sets a processor affinity for the specified thread.

Syntax

BOOL WINAPI CeSetThreadAffinity (
    HANDLE hThread,
    DWORD dwProcessor
);

Parameters

  • hThread
    [in] Handle to the thread whose affinity mask is to be set.
  • dwProcessor
    [in] Processor to set the affinity of the thread to. Set to zero if no affinity is to be set.

Return Value

TRUE indicates success. FALSE indicates failure. Call GetLastError to obtain extended error information.

Remarks

Setting an affinity for a process or thread can result in threads receiving less processor time, as the system is restricted from running the threads on certain processors. In most cases, it is better to let the system select an available processor.

If the new thread affinity does not specify the processor that is currently running the thread, the thread is rescheduled on one of the available processors.

Requirements

Header

kfuncs.h,
winbase.h

Library

coredll.lib

See Also

Reference

SMP Functions
CeGetThreadAffinity
CeSetProcessAffinity
CeGetProcessAffinity