[fpc-pascal] values for ThreadSetPriority

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Feb 11 07:49:25 CET 2010


Seth Grover wrote:
> http://www.hu.freepascal.org/docs-html/rtl/system/threadsetpriority.html
> says that it takes for a priority values from -15 to 15. The comment


I always thought I knew the answer, but then when I searched for the
answers in the source code, it started getting really confusing! :-(

In classesh.inc we have:

  TThreadPriority = (tpIdle, tpLowest, tpLower, tpNormal, tpHigher, tpHighest,
    tpTimeCritical);


Then in unix/thread.inc we have:

  // stupid, considering its not even implemented...
  Priorities: array [TThreadPriority] of Integer =
   (-20,-19,-10,0,9,18,19);

This already conflicts with the documentation which says the range is -15
to 15. Go figure!

Then we also have in linux/pthread.inc

  const
     THREAD_PRIORITY_IDLE               = 1;
     THREAD_PRIORITY_LOWEST             = 15;
     THREAD_PRIORITY_BELOW_NORMAL       = 30;
     THREAD_PRIORITY_NORMAL             = 50;
     THREAD_PRIORITY_ABOVE_NORMAL       = 70;
     THREAD_PRIORITY_HIGHEST            = 80;
     THREAD_PRIORITY_TIME_CRITICAL      = 99;


So there you go!  I'm not just as confused as you are. ;-)


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list