Hi Teamers

I recently asked for help to lower the priority of my batchfile project so that
interactive applications could work unrestrained in the foreground.  For the
record (and for those interested) ...

Suggestions centred around two courses of action, one using Win32 and the other
Ada.Dynamic_Priorities from Annex D.5.  I was using Gnat 3.15p and found that
this:


with Win32.Winbase; use Win32.Winbase;
procedure Foo is

   Priority_Set : Win32.Bool := SetPriorityClass(GetCurrentProcess,
Idle_Priority_Class);

begin  -- Foo

   . . .

end Foo;


works.  The priority of the program is shown by Windows Task Manager as "Low"
and User-oriented interactive applications work unhindered in the foreground
while the batch work continues as CPU is available.  The trick was that I was
using an Integer as the second Actual Parameter - I had to use the Constant. 
However ...   Unfortunately, this:


with Ada.Dynamic_Priorities; use Ada.Dynamic_Priorities;
with System;                 use System;
procedure Foo is
begin  -- Foo
   Set_Priority(Priority => Any_Priority'First);

   . . .

end Foo;


does not work and (working from Annex D.1) neither does:


procedure Foo is

   pragma Priority(1);

begin  -- Foo

   . . .

end Foo;


Both of these leave the priority of the application set to "Normal" and the
application interferes with foreground activity despite a liberal sprinkling of
"delay 0.0;" statements.

I must have something wrong in my coding for the use of Annex D because I
believe that prioritisation was always supported by the Gnat Ada Compilers. 
However, trying the same experiments with the new Gnat compiler (GAP 1.1.0)
produced the same results.  If anyone can tell me where the SNAFU is I'd
appreciate it.  I certainly can't find it.

BTW: You just have to have the Win32 stuff saved when you change to the new
compiler.

Keep the faith
-------------------------------------------
"Professional qualitative judgement
   consists in knowing the rules
     for using (or occasionally breaking)
       the rules."
                            D. Royce Sadler
-------------------------------------------
Rick Duley
Murdoch University
School of Engineering Science
Perth, Western Australia
http://eng.murdoch.edu.au/~rick
aussie : 040 910 6049                .-_|\
o'seas : + 61 40 910 6049           /     \
                              perth *_.-._/
                                         v