home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxprior.zip / rxprior.cmd < prev    next >
OS/2 REXX Batch file  |  1994-01-18  |  3KB  |  78 lines

  1. /*--------------------------------------------------------------------
  2.    Copyright IBM Corp., 1993,1994.  All Rights Reserved.
  3.  
  4.    OS/2 is a registered trademark of the IBM Corp.
  5.  
  6.    While the information provided herein is believed to be accurate, IBM
  7.    does not warrant the information, and the information is provided "as
  8.    is".
  9. ---------------------------------------------------------------------*/
  10.  
  11. /*------------------------------------------------------------------
  12.  * rxprior.cmd : test the external functions in rxprior.dll
  13.  *------------------------------------------------------------------*/
  14.  
  15. "@echo off"
  16.  
  17. /*------------------------------------------------------------------
  18.  * load functions
  19.  *------------------------------------------------------------------*/
  20. if RxFuncQuery("SysSetPriority") then
  21.    do
  22.    rc = RxFuncAdd("SysSetPriority","RxPrior","SysSetPriority")
  23.    rc = RxFuncAdd("SysGetPriority","RxPrior","SysGetPriority")
  24.    end
  25.  
  26. /*------------------------------------------------------------------
  27.  * print the current priority
  28.  *------------------------------------------------------------------*/
  29. say "current priority:" SysGetPriority()
  30.  
  31. /*------------------------------------------------------------------
  32.  * change the priority a few times, and print info each time
  33.  *------------------------------------------------------------------*/
  34.  
  35. call Test "-1",  "NOCHANGE"          , "PROCESS"
  36. call Test "-1",  "REGULAR"           , "THREAD"
  37. call Test "-1",  "TIMECRITICAL"      , ""
  38. call Test "-1",  "FOREGROUNDSERVER"  , "GARBAGE"
  39.  
  40. call Test "0"
  41. call Test "0", "NOCHANGE"
  42. call Test "1", "NOCHANGE"
  43. call Test "2", "NOCHANGE"
  44. call Test "3", "NOCHANGE"
  45.  
  46. call Test "0", "REGULAR"
  47.  
  48. exit
  49.  
  50. /*------------------------------------------------------------------
  51.  * run one test
  52.  *------------------------------------------------------------------*/
  53. Test: procedure expose pid
  54.    delta = arg(1)
  55.    class = arg(2)
  56.    scope = arg(3)
  57.  
  58.    /*---------------------------------------------------------------
  59.     * call with different # of parameters to test defaulting
  60.     *---------------------------------------------------------------*/
  61.    if      (arg() = 1) then rc = SysSetPriority(delta)
  62.    else if (arg() = 2) then rc = SysSetPriority(delta,class)
  63.    else if (arg() = 3) then rc = SysSetPriority(delta,class,scope)
  64.  
  65.    if (rc <> 0) then
  66.       say "rc =" rc "from SysSetPriority("delta","class","scope")"
  67.  
  68.    /*---------------------------------------------------------------
  69.     * get the priority
  70.     *---------------------------------------------------------------*/
  71.    priority = SysGetPriority()
  72.  
  73.    say "priority =" priority,
  74.        "from SysSetPriority("delta","class","scope")"
  75.  
  76.    return
  77.  
  78.