1 { Copyright (C) 2005 Bas Steendijk and Peter Green
\r 
   2   For conditions of distribution and use, see copyright notice in zlib_license.txt
\r 
   3   which is included in the package
\r 
   4   ----------------------------------------------------------------------------- }
\r 
  20   classpriority,threadpriority:integer;
\r 
  25   hprocess,hthread:thandle;
\r 
  27   if (refcount = 0) then begin
\r 
  28     hProcess := GetCurrentProcess;
\r 
  29     hThread := GetCurrentThread;
\r 
  30     ClassPriority := GetPriorityClass(hProcess);
\r 
  31     ThreadPriority := GetThreadPriority(hThread);
\r 
  32     SetPriorityClass(hProcess, REALTIME_PRIORITY_CLASS);
\r 
  33     SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
\r 
  40   hprocess,hthread:thandle;
\r 
  43   if (refcount < 0) then refcount := 0;
\r 
  44   if (refcount = 0) then begin
\r 
  45     hProcess := GetCurrentProcess;
\r 
  46     hThread := GetCurrentThread;
\r 
  47     SetPriorityClass(hProcess, ClassPriority);
\r 
  48     SetThreadPriority(hThread,  ThreadPriority);
\r