DosSetThreadAffinity: Difference between revisions
Appearance
mNo edit summary |
|||
Line 1: | Line 1: | ||
DosSetThreadAffinity allows the calling thread to change the processor affinity mask for the current thread. | |||
DosSetThreadAffinity allows the calling thread to change the processor affinity mask for the current thread. | |||
==Syntax== | ==Syntax== | ||
APIRET DosSetThreadAffinity (PMPAffinity pAffinityMask) | |||
APIRET DosSetThreadAffinity | |||
==Parameters== | ==Parameters== | ||
; | ;pAffinityMask (PMPAffinity) input:Address of an MPAFFINITY structure that will become the current thread's affinity mask. | ||
==Return Code== | ==Return Code== | ||
ulrc APIRET) returns | ulrc APIRET) returns | ||
DosSetThreadAffinity returns one of the following values | DosSetThreadAffinity returns one of the following values | ||
*13 ERROR_INVALID_DATA | |||
*87 ERROR_INVALID_PARAMETER | |||
==Remarks== | ==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. | 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== | ==Example Code== | ||
<PRE> | <PRE> | ||
#define INCL_DOS#define INCL_32 | #define INCL_DOS | ||
#define INCL_32 | |||
#define INCL_DOSERRORS | #define INCL_DOSERRORS | ||
#define INCL_NOPMAPI | #define INCL_NOPMAPI | ||
#include | #include <os2.h> | ||
#include | #include <stdio.h> | ||
rc = DosSetThreadAffinity( affinity); | int main(void){ | ||
printf("Set thread's affinity rc = %08.8xh\n", rc); | APIRET rc; | ||
printf("Set thread's affinity affinity[0] = %08.8xh, affinity[1] = %08.8xh\n", | MPAFFINITY affinity; | ||
return rc; | 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; | |||
} | } | ||
</PRE> | |||
==Related Functions== | ==Related Functions== | ||
*[[DosQueryThreadAffinity]] | *[[DosQueryThreadAffinity]] | ||
[[Category:Dos]] | [[Category:Dos]] |
Revision as of 04:39, 26 October 2017
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
#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; }