SetThreadAffinityMask
SetThreadAffinityMask sets a processor affinity mask for the specified thread.
Syntax
DWORD_PTR SetThreadAffinityMask(
HANDLE hThread,
DWORD_PTR dwThreadAffinityMask
);
Parameters
hThread
A handle to the thread whose affinity mask is to be set.
dwThreadAffinityMask
The affinity mask for the thread.
Return Value
If the function succeeds, it returns the thread's previous affinity mask.
If the function fails, it returns 0 (zero). To get extended error information, call GetLastError.
Remarks
A thread affinity mask is a bit vector in which each bit represents the processors that a thread is allowed to run on.
A thread affinity mask must be a subset of the process affinity mask for the containing process of a thread. A thread can only run on the processors its process can run on.
Moving a thread is equivalent to resetting its processor affinity mask. Running threads must first be suspended before their affinity may be reset. In addition, threads that use Floating Point, MMX, AVX, or SSE registers cannot be moved. You can move the thread until the first floating point, MMX, AVX, or SSE instruction is called, after which you cannot move it.
Requirements
Minimum supported version | Header | Library |
---|---|---|
eRTOS 1.0 SDK |
windows.h | rtkrnl.lib |
See Also: