SetThreadSelectedCpuSets function (processthreadsapi.h)

Sets the selected CPU Sets assignment for the specified thread. This assignment overrides the process default assignment, if one is set.


BOOL SetThreadSelectedCpuSets(
  HANDLE      Thread,
  const ULONG *CpuSetIds,
  ULONG       CpuSetIdCount



Specifies the thread on which to set the CPU Set assignment. This handle must have the THREAD_SET_LIMITED_INFORMATION access right. The value returned by GetCurrentThread can also be used.


Specifies the list of CPU Set IDs to set as the thread selected CPU set. If this is NULL, the API clears out any assignment, reverting to process default assignment if one is set.


Specifies the number of IDs in the list passed in the CpuSetIds argument. If that value is NULL, this should be 0.

Return value

If the function succeeds, the return value is nonzero.

This function cannot fail when passed valid parameters.


Minimum supported client Windows 10
Minimum supported server Windows Server 2016
Header processthreadsapi.h
DLL kernel32.dll