]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Restore previous mapping for Ada to Win32 task priorities
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 3 Dec 2025 23:48:43 +0000 (00:48 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 9 Jan 2026 10:57:15 +0000 (11:57 +0100)
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.

gcc/ada/libgnat/system-mingw.ads

index d0df352e4809f0dffdf1b26ad0b7ba98e5ba5bc6..5516b627d4a5d8b2eff5304a82fa1cde359f84d2 100644 (file)
@@ -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.