home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / hcshdemo.zip / csh-os2.zip / SAMPLES / GETPRIO.C < prev    next >
C/C++ Source or Header  |  1993-09-28  |  952b  |  32 lines

  1. /***************************************************************************/
  2. /*                                                                                                    */
  3. /*                                                                                                    */
  4. /*            Retrieve and print the current scheduling priority.                    */
  5. /*        Copyright (c) 1990 by Hamilton Laboratories.  All rights reserved.    */
  6. /*                                                                                                    */
  7. /*                                                                                                    */
  8. /***************************************************************************/
  9.         
  10. #include <stdio.h>
  11. #define    INCL_DOSPROCESS
  12. #define    ushort    USHORT
  13. #include <os2.h>
  14.  
  15. void cdecl main( void )
  16.         {
  17.         static char *priority_class[] =
  18.             {    "",
  19.                 "Idle Time",
  20.                 "Regular",
  21.                 "Time Critical",
  22.                 "Foreground"        };
  23.  
  24.         ushort prio, rc;
  25. #        define    Class(p)        ((p) >> 8)
  26. #        define    Level(p)        ((p) & 0xff)
  27.         rc = DosGetPrty(PRTYS_THREAD, &prio, 0);
  28.         printf("rc = %d, prio = 0x%04x, class = %s(%d), level = %d\n", rc, prio,
  29.             priority_class[Class(prio)], Class(prio), Level(prio));
  30.         exit(0);
  31.         }
  32.