DosSetThreadAffinity: Difference between revisions
Appearance
Created page with "==Description== DosSetThreadAffinity allows the calling thread to change the processor affinity mask for the current thread. ==Syntax== <PRE> APIRET DosSetThreadAffinity ..." |
|||
(4 intermediate revisions by the same user not shown) | |||
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== | ||
DosSetThreadAffinity (pAffinityMask) | |||
==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:DosSetThreadAffinity returns one of the following values | |||
::13 ERROR_INVALID_DATA | |||
DosSetThreadAffinity returns one of the following values | ::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> | ||
int main(void) | int main(void){ | ||
{ | APIRET rc; | ||
APIRET rc; | MPAFFINITY affinity; | ||
MPAFFINITY affinity; | |||
rc = DosSetThreadAffinity(affinity); | |||
rc = DosSetThreadAffinity( affinity); | printf("Set thread's affinity rc = %08.8xh\n", rc); | ||
printf("Set thread's affinity rc = %08.8xh\n", rc); | printf("Set thread's affinity affinity[0] = %08.8xh, affinity[1] = %08.8xh\n", | ||
printf("Set thread's affinity affinity[0] = %08.8xh, affinity[1] = %08.8xh\n", | affinity.mask[0], affinity.mask[1]); | ||
return rc; | |||
return rc; | |||
} | } | ||
</PRE> | |||
==Related Functions== | ==Related Functions== | ||
* [[ | *[[DosQueryThreadAffinity]] | ||
[[Category: | [[Category:Dos]] |
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; }