Difference between revisions of "DosQueryThreadAffinity"

From EDM2
Jump to: navigation, search
m (Related Functions)
m
Line 1: Line 1:
==Description==
+
DosQueryThreadAffinity allows a thread to inquire for the current thread's processor affinity mask and the system's capable processor affinity mask.
DosQueryThreadAffinity allows a thread to inquire for the current thread's processor affinity mask and the system's capable processor affinity mask.  
+
  
 
==Syntax==
 
==Syntax==
<PRE>
 
 
  APIRET DosQueryThreadAffinity (ULONG scope, PMPAffinity pAffinityMask)
 
  APIRET DosQueryThreadAffinity (ULONG scope, PMPAffinity pAffinityMask)
</PRE>
+
 
 
==Parameters==
 
==Parameters==
; scope(ULONG) input  
+
;scope(ULONG) input
 
+
:AFNTY_THREAD Return the current threads processor affinity mask.
AFNTY_THREAD Return the current threads processor affinity mask.  
+
:AFNTY_SYSTEM Return the system's current capable 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].
 
+
; 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==
 
==Return Code==
 
  ulrc APIRET) returns
 
  ulrc APIRET) returns
 
 
DosQueryThreadAffinity returns one of the following values
 
DosQueryThreadAffinity returns one of the following values
 +
*13 ERROR_INVALID_DATA
 +
*87 ERROR_INVALID_PARAMETER
  
* 13      ERROR_INVALID_DATA
 
* 87      ERROR_INVALID_PARAMETER
 
 
==Remarks==
 
==Remarks==
 
DosQueryThreadAffinity allows a thread to ask the Processor Affinity Mask for
 
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 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.
 
* 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==
 
==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 os2.h>
+
#include <os2.h>
#include stdio.h>
+
#include <stdio.h>
  
int main(void) {
+
int main(void){
APIRET rc;
+
  APIRET rc;
MPAFFINITY affinity;
+
  MPAFFINITY affinity;
  
rc = DosQueryThreadAffinity(AFNTY_SYSTEM, affinity);
+
  rc = DosQueryThreadAffinity(AFNTY_SYSTEM, affinity);
printf("Query system's affinity  rc = %08.8xh\n",rc);
+
  printf("Query system's affinity  rc = %08.8xh\n",rc);
printf("Query system's affinity  affinity[0] = %08.8xh, affinity[1] = %08.8xh\n",
+
  printf("Query system's affinity  affinity[0] = %08.8xh, affinity[1] = %08.8xh\n",
        affinity.mask[0], affinity.mask[1]);
+
          affinity.mask[0], affinity.mask[1]);
return rc;
+
  return rc;
 
}
 
}
 
</PRE>
 
</PRE>
 +
 
==Related Functions==
 
==Related Functions==
 
*[[DosSetThreadAffinity]]
 
*[[DosSetThreadAffinity]]
  
 
[[Category:Dos]]
 
[[Category:Dos]]

Revision as of 02:42, 26 October 2017

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

#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 = 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