DosQueryThreadAffinity

DosQueryThreadAffinity allows a thread to inquire for the current thread's processor affinity mask and the system's capable processor affinity mask.

Syntax
APIRET DosQueryThreadAffinity (ULONG scope, PMPAffinity pAffinityMask)

Parameters

 * scope(ULONG) input
 * AFNTY_THREAD Return the current threads processor affinity mask.
 * AFNTY_SYSTEM Return the system's current capable processor affinity mask.


 * pAffinityMask(PMPAffinity) input : Address of MPAffinity structure to receive the affinity mask. Processors 0 31 are in mask [0] and processors 32 63 are in mask [1].

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

Remarks
DosQueryThreadAffinity allows a thread to ask the Processor Affinity Mask for
 * The current thread's processor affinity mask, scope =AFNTY_THREAD, returns qwThreadAffinity, for the calling thread.
 * The system's capable processor affinity mask, scope=AFNTY_SYSTEM, returns qwCapableAffinity for the system. The caller may then use any subset of the returned affinity mask to change the threads processor affinity in a later call to DosSetThreadAffinity.

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 = DosQueryThreadAffinity(AFNTY_SYSTEM, affinity); printf("Query system's affinity rc = %08.8xh\n",rc); printf("Query system's affinity affinity[0] = %08.8xh, affinity[1] = %08.8xh\n",          affinity.mask[0], affinity.mask[1]); return rc; } 

Related Functions

 * DosSetThreadAffinity