Getprio.c



/***************************************************************************/
/*                                                                         */
/*                                                                         */
/*       Retrieve and print the current scheduling priority.               */
/*    Copyright (c) 1990-2001 by Hamilton Laboratories.  All rights reserved.   */
/*                                                                         */
/*                                                                         */
/***************************************************************************/
      
#include <stdio.h>
#define  INCL_DOSPROCESS
#define  ushort   USHORT
#include <os2.h>

void cdecl main( void )
      {
      static char *priority_class[] =
         {  "",
            "Idle Time",
            "Regular",
            "Time Critical",
            "Foreground"      };

      ushort prio, rc;
#     define   Class(p)    ((p) >> 8)
#     define   Level(p)    ((p) & 0xff)
      rc = DosGetPrty(PRTYS_THREAD, &prio, 0);
      printf("rc = %d, prio = 0x%04x, class = %s(%d), level = %d\n", rc, prio,
         priority_class[Class(prio)], Class(prio), Level(prio));
      exit(0);
      }



Hamilton C shell | Free Updates | Free Demo Software | Win32 Training
Y2K | Customer Testimonials | On-line Hamilton C shell User Guide
Home | Email | Support | Company Profile | Distributors | Links



Copyright © 1997-2001 by Hamilton Laboratories. All rights reserved.
You are visitor number 390. This page was last modified August 9, 2001.