DosSetThreadAffinity

DosSetThreadAffinity allows the calling thread to change the processor affinity mask for the current thread.

Syntax
APIRET DosSetThreadAffinity (PMPAffinity pAffinityMask)

Parameters

 * pAffinityMask (PMPAffinity) input:Address of an MPAFFINITY structure that will become the current thread's affinity mask.

Return Code
ulrc APIRET) returns DosSetThreadAffinity returns one of the following values
 * 13 ERROR_INVALID_DATA
 * 87 ERROR_INVALID_PARAMETER

Remarks
The processor affinity mask contains 1 bit per processor. A maximum of 64 processors can be designated. If affinity bits are on for non-existent processors, the error ERROR_INVALID_DATA will be returned.

Example Code

 * 1) define INCL_DOS
 * 2) define INCL_32
 * 3) define INCL_DOSERRORS
 * 4) define INCL_NOPMAPI
 * 5) include 
 * 6) include 

int main(void){ APIRET rc; MPAFFINITY affinity; rc = DosSetThreadAffinity(affinity); printf("Set thread's affinity rc = %08.8xh\n", rc); printf("Set thread's affinity affinity[0] = %08.8xh, affinity[1] = %08.8xh\n",          affinity.mask[0], affinity.mask[1]); return rc; } 

Related Functions

 * DosQueryThreadAffinity