SetProcessAffinityMask

SetProcessAffinityMask sets a processor affinity mask for the threads of the specified process.

Syntax

Copy
BOOL SetProcessAffinityMask(
    HANDLE hProcess,
    DWORD_PTR dwProcessAffinityMask
);

Parameters

hProcess

A handle to the process whose affinity mask is to be set.

dwProcessAffinityMask

The affinity mask for all the threads of the process.

Return Value

If the function succeeds, it returns a non-zero value; if the function fails, it returns 0 (zero) .

To get extended error information, call GetLastError.

Remarks

A process affinity mask is a bit vector in which each bit represents the processor on which the threads of the process are allowed to run.

The value of the process affinity mask must be a subset of the Process system affinity mask values obtained by the GetProcessAffinityMask function.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

windows.h rtkrnl.lib

See Also: