Parameters
hThread
[in] Handle to the thread whose affinity mask is to be set.
This handle must have the THREAD_SET_INFORMATION and THREAD_QUERY_INFORMATION access rights. For more information, see Thread Security and Access Rights.
dwThreadAffinityMask
[in] Affinity mask for the thread.
Windows Me/98/95: This value must be 1.
Return Values
If the function succeeds, the return value is the thread's previous affinity mask.
Windows Me/98/95: The return value is 1. To succeed, hThread must be valid and dwThreadAffinityMask must be 1.
If the function fails, the return value is 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 proper subset of the process affinity mask for the containing process of a thread. A thread is only allowed to run on the processors its process is allowed to run on.
Requirements
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation 3.5 and later, Windows Me, Windows 98, and Windows 95.
Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server 3.5 and later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.