From: Piotr Trojanek <[email protected]>

This patch restores previous mapping of Ada to Win32 task priorities used
when no pragma Task_Dispatching_Policy (FIFO_Within_Priorities) is present
(except for wrong mapping to values that can only be used for processes
with REALTIME_PRIORITY_CLASS).

The new mapping is consistent with the one used when that pragma is present
and provides distinct values for priorities in range of Default_Priority +/- 2.

gcc/ada/ChangeLog:

        * libgnat/system-mingw.ads (Underlying_Priorities): Restore previous
        mapping with distinct values around Default_Priority.

Tested on x86_64-pc-linux-gnu (before the recent bootstrap breakage), committed 
on master.

---
 gcc/ada/libgnat/system-mingw.ads | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/libgnat/system-mingw.ads b/gcc/ada/libgnat/system-mingw.ads
index d0df352e480..5516b627d4a 100644
--- a/gcc/ada/libgnat/system-mingw.ads
+++ b/gcc/ada/libgnat/system-mingw.ads
@@ -191,16 +191,15 @@ private
    --  pragma Task_Dispatching_Policy (FIFO_Within_Priorities).
 
    Underlying_Priorities : constant Priorities_Mapping :=
-     (Priority'First     => -15,  --  Thread_Priority_Idle
-      1  ..  6           =>  -2,  --  Thread_Priority_Lowest
-      7  .. 12           =>  -1,  --  Thread_Priority_Below_Normal
-      13 .. 14           =>   0,  --  Thread_Priority_Normal
-      Default_Priority   =>   0,  --  Thread_Priority_Normal
-      16 .. 18           =>   0,  --  Thread_Priority_Normal
-      19 .. 24           =>   1,  --  Thread_Priority_Above_Normal
-      25 .. 29           =>   2,  --  Thread_Priority_Highest
-      Priority'Last      =>   2,  --  Thread_Priority_Highest
-      Interrupt_Priority =>  15); --  Thread_Priority_Time_Critical
+     (Priority'First ..
+      Default_Priority - 3    => -15,  --  Thread_Priority_Idle
+      Default_Priority - 2    => -2,   --  Thread_Priority_Lowest
+      Default_Priority - 1    => -1,   --  Thread_Priority_Below_Normal
+      Default_Priority        => 0,    --  Thread_Priority_Normal
+      Default_Priority + 1    => 1,    --  Thread_Priority_Above_Normal
+      Default_Priority + 2 ..
+      Priority'Last           => 2,    --  Thread_Priority_Highest
+      Interrupt_Priority      => 15);  --  Thread_Priority_Time_Critical
    --  The non FIFO mapping preserves the standard 31 priorities of the Ada
    --  model, but maps them using compression onto the 7 priority levels
    --  available in NT when pragma Task_Dispatching_Policy is unspecified.
-- 
2.51.0

Reply via email to