GetThreadSelectedCpuSets function

Returns the explicit CPU Set assignment of the specified thread, if any assignment was set using the SetThreadSelectedCpuSets API. If no explicit assignment is set, RequiredIdCount is set to 0 and the function returns TRUE.


BOOL WINAPI GetThreadSelectedCpuSets(
  _In_      HANDLE Thread,
  _Out_opt_ PULONG CpuSetIds,
  _In_      ULONG  CpuSetIdCount,
  _Out_     PULONG RequiredIdCount


Thread [in]

Specifies the thread for which to query the selected CPU Sets. This handle must have the THREAD_QUERY_LIMITED_INFORMATION access right. The value returned by GetCurrentThread can also be specified here.

CpuSetIds [out, optional]

Specifies an optional buffer to retrieve the list of CPU Set identifiers.

CpuSetIdCount [in]

Specifies the capacity of the buffer specified in CpuSetIds. If the buffer is NULL, this must be 0.

RequiredIdCount [out]

Specifies the required capacity of the buffer to hold the entire list of thread selected CPU Sets. On successful return, this specifies the number of IDs filled into the buffer.

Return value

This API returns TRUE on success. If the buffer is not large enough, the GetLastError value is ERROR_INSUFFICIENT_BUFFER. This API cannot fail when passed valid parameters and the return buffer is large enough.


Minimum supported client
Windows 10 [desktop apps | UWP apps]
Minimum supported server
Windows Server 2016 [desktop apps | UWP apps]