DosSetThreadAffinity: Difference between revisions
Appearance
mNo edit summary |
|||
Line 8: | Line 8: | ||
==Return Code== | ==Return Code== | ||
;ulrc APIRET) returns:DosSetThreadAffinity returns one of the following values | ;ulrc (APIRET) returns:DosSetThreadAffinity returns one of the following values | ||
::13 ERROR_INVALID_DATA | ::13 ERROR_INVALID_DATA | ||
::87 ERROR_INVALID_PARAMETER | ::87 ERROR_INVALID_PARAMETER |
Latest revision as of 23:17, 8 December 2023
DosSetThreadAffinity allows the calling thread to change the processor affinity mask for the current thread.
Syntax
DosSetThreadAffinity (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
#define INCL_DOS #define INCL_32 #define INCL_DOSERRORS #define INCL_NOPMAPI #include <os2.h> #include <stdio.h> 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; }