-- LXD70071.A -- -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- -- OBJECTIVE: -- See LXD70072.AM -- -- TEST FILES: -- This test consists of the following files: -- LXD70070.A A text file containing the Restrictions pragma. -- => LXD70071.A A package which has calls to Dynamic_Priorities. -- LXD70072.AM The main program. -- -- CHANGE HISTORY: -- 06 Dec 94 SAIC ACVC 2.0 -- 02 Oct 96 SAIC Multi-file prolog convention fix. -- 02 Feb 17 RLB Added missing error tag (and location indicator). -- --! package LXD70071 is task Credit_Task is entry Input; end Credit_Task; end LXD70071; -- The following isn't allowed when restriction No_Dynamic_Priorities is -- in force. with Ada.Dynamic_Priorities; -- OPTIONAL ERROR: {1} with system; package body LXD70071 is package ADP renames Ada.Dynamic_Priorities; task body Credit_Task is Base_Priority : System.Any_Priority := ADP.Get_Priority; Current_Priority : System.Any_Priority := Base_Priority; Queue_Overload_Threshold : integer := 50; Queue_Underload_Threshold : integer := 45; begin loop accept Input do null; -- Application code end Input; -- SAMPLE code calling Ada.Dynamic_Priorities -- After each transaction is handled check the thresholds if Current_Priority /= Base_Priority then -- We are in the overload situation, check if we have reached -- underload if Input'Count < Queue_Underload_Threshold then -- Below the underload, reset priority ADP.Set_Priority (Base_Priority); Current_Priority := Base_Priority; end if; else -- check if we have just gone into overload if Input'Count > Queue_Overload_Threshold then -- yes, increase the priority ADP.Set_Priority (System.Priority'Last); Current_Priority := System.Priority'Last; end if; end if; end loop; end Credit_Task; begin -- LXD70071 null; end LXD70071;