Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 3.31 KB

nf-processthreadsapi-getthreadselectedcpusetmasks.md

File metadata and controls

91 lines (66 loc) · 3.31 KB
UID tech.root title ms.date ms.topic targetos description req.assembly req.construct-type req.ddi-compliance req.dll req.header req.idl req.include-header req.irql req.kmdf-ver req.lib req.max-support req.namespace req.redist req.target-min-winverclnt req.target-min-winversvr req.target-type req.type-library req.umdf-ver req.unicode-ansi topic_type api_type api_location api_name f1_keywords helpviewer_keywords dev_langs
NF:processthreadsapi.GetThreadSelectedCpuSetMasks
processthreadsapi
GetThreadSelectedCpuSetMasks
03/12/2021
language-reference
Windows
Returns the explicit CPU Set assignment of the specified thread, if any assignment was set using SetThreadSelectedCpuSetMasks or SetThreadSelectedCpuSets.
function
kernel32.dll
processthreadsapi.h
Windows 11
Windows Server 2022
apiref
DllExport
kernel32.dll
api-ms-win-core-processthreads-l1-1-6
GetThreadSelectedCpuSetMasks
GetThreadSelectedCpuSetMasks
processthreadsapi/GetThreadSelectedCpuSetMasks
GetThreadSelectedCpuSetMasks
processthreadsapi/GetThreadSelectedCpuSetMasks
c++

-description

Returns the explicit CPU Set assignment of the specified thread, if any assignment was set using SetThreadSelectedCpuSetMasks or SetThreadSelectedCpuSets.

-parameters

-param Thread

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

-param CpuSetMasks

Specifies an optional buffer to retrieve a list of GROUP_AFFINITY structures representing the thread selected CPU Sets.

-param CpuSetMaskCount

Specifies the size of the CpuSetMasks array, in elements.

-param RequiredMaskCount

On successful return, specifies the number of affinity structures written to the array. If the array is too small, the function fails with ERROR_INSUFFICIENT_BUFFER and sets the RequiredMaskCount parameter to the number of elements required. The number of required elements is always less than or equal to the maximum group count returned by GetMaximumProcessorGroupCount.

-returns

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero and extended error information can be retrieved by calling GetLastError.

If the array supplied is too small, the error value is ERROR_INSUFFICIENT_BUFFER and the RequiredMaskCount is set to the number of elements required.

-remarks

If no explicit assignment is set, RequiredMaskCount is set to 0 and the function succeeds.

This function is analogous to GetThreadSelectedCpuSets, except that it uses group affinities as opposed to CPU Set IDs to represent a list of CPU sets. This means that the thread selected CPU Sets are mapped to their home processors, and those processors are retrieved in the resulting list of group affinities.

-see-also