CVS difference for ais/ai-00354.txt

Differences between 1.6 and version 1.7
Log of other versions for file ais/ai-00354.txt

--- ais/ai-00354.txt	2004/04/06 19:57:15	1.6
+++ ais/ai-00354.txt	2004/07/27 23:01:05	1.7
@@ -1,10 +1,12 @@
-!standard D.03 (00)                                   04-03-25  AI95-00354/04
+!standard D.14.2 (01)                                 04-06-25  AI95-00354/05
 !class amendment 03-09-27
+!status Amendment 200Y 04-06-25
+!status ARG Approved 7-0-1  04-06-13
 !status work item 03-09-27
 !status received 03-09-27
 !priority Low
 !difficulty Medium
-!subject Group Execution-Time Budgets
+!subject Group execution-time budgets
 
 !summary
 
@@ -45,7 +47,7 @@
   type Handler is not null access
        protected procedure(GB : in out Group_Budget);
 
-  type Task_Array is array(Natural range <>) of
+  type Task_Array is array(Positive range <>) of
                                   Ada.Task_Identification.Task_ID;
 
   Min_Handler_Ceiling : constant System.Any_Priority :=
@@ -175,7 +177,7 @@
 
 private
   protected type Controller(DS : access Deferrable_Server) is
-    procedure Budget_Expired(GB: in out Group_Budget);
+    procedure Budget_Has_Expired(GB: in Group_Budget);
     procedure Replenish_Due(TE : in out Timing_Event);
     pragma Priority(Priority'Last);
   end Controller;
@@ -221,13 +223,13 @@
   end Add;
 
   protected body Controller is
-    procedure Budget_Expired(GB : in out Group_Budget) is
+    procedure Budget_Has_Expired(GB : in Group_Budget) is
       TA : Task_Array := Members(GB);
     begin
       for ID in TA'Range loop
         Ada.Asynchronous_Control.Hold(TA(ID));
       end loop;
-    end Budget_Expired;
+    end Budget_Has_Expired;
 
     procedure Replenish_Due(TE : in out Timing_Event) is
       TA : Task_Array;
@@ -280,6 +282,135 @@
 
 This was rejected because not all Aperiodic Server approaches
 suspend the tasks, some set the tasks' priorities to a background priority.
+
+!corrigendum D.14.2(01)
+
+@dinsc
+
+This clause specifies a group execution time control package.
+
+@i<@s8<Static Semantics>>
+
+The following language-defined library package exists:
+
+@xcode<@b<with> System;
+@b<with> Ada.Task_Identification;
+@b<package> Ada.Execution_Time.Group_Budgets @b<is>
+  @b<type> Group_Budget @b<is limited private>;
+
+  @b<type> Handler @b<is not null access>
+       @b<protected procedure>(GB : @b<in out> Group_Budget);
+
+  @b<type> Task_Array @b<is array>(Positive @b<range> <@>) @b<of>
+                                  Ada.Task_Identification.Task_ID;
+
+  Min_Handler_Ceiling : @b<constant> System.Any_Priority :=
+    @ft<@i<implementation-defined>>;
+
+  @b<procedure> Add_Task(GB: @b<in out> Group_Budget;
+                       T : Ada.Task_Identification.Task_ID);
+  @b<procedure> Remove_Task(GB: @b<in out> Group_Budget;
+                       T : Ada.Task_Identification.Task_ID);
+  @b<function> Is_Member(GB: Group_Budget;
+             T : Ada.Task_Identification.Task_ID) @b<return> Boolean;
+  @b<function> Is_A_Group_Member(
+             T : Ada.Task_Identification.Task_ID) @b<return> Boolean;
+  @b<function> Members(GB: Group_Budget) @b<return> Task_Array;
+
+  @b<procedure> Replenish (GB: @b<in out> Group_Budget; To : Time_Span);
+  @b<procedure> Add(GB: @b<in out> Group_Budget; Interval : Time_Span);
+  @b<function> Budget_Has_Expired(GB: Group_Budget) @b<return> Boolean;
+  @b<function> Budget_Remaining(GB: Group_Budget) @b<return> Time_Span;
+
+  @b<procedure> Set_Handler(GB: @b<in out> Group_Budget; H : Handler);
+  @b<function> Current_Handler(GB: Group_Budget) @b<return> Handler;
+  @b<procedure> Cancel_Handler(GB: @b<in out> Group_Budget;
+               Cancelled : @b<out> Boolean);
+
+  Group_Budget_Error : @b<exception>;
+@b<private>
+    --  not specified by the language
+@b<end> Ada.Execution_Time.Group_Budgets;>
+
+The type Group_Budget represents a CPU budget to be used by a
+group of tasks. This type needs finalization (see 7.6).
+
+An object of type Group_Budget is said to be set if it has a
+registered Handler. An object is said to be cleared if it has
+no Handler. All Group_Budget objects are initially cleared.
+
+@i<@s8<Dynamic Semantics>>
+
+Tasks of any priority are added to a group by calling Add_Task.
+Tasks are members of at most one group. Group_Budget_Error
+is raised by a call to Add_Task if the task is already a member
+of any group.
+
+Tasks are removed from a group by calling Remove_Task.
+An attempt to remove a task that has not been added to the
+group will cause Group_Budget_Error to be raised.
+
+The Is_Member function will return True if the task parameter is
+a member of the specified group. The Is_A_Group_Member function returns
+True if the task is a member of any group. Both return False otherwise.
+
+The Members function returns the task IDs of the members of the group.
+
+When a call to Replenish is made, the Group_Budget is loaded with the
+Time_Span value passed as a parameter. Any execution of the group of
+tasks results in the Group_Budget counting down. When the budget is
+exhausted (goes to Time_Span_Zero) the handler, if set, is called; the tasks
+continue to execute. A Group_Budget is initially loaded with zero budget.
+
+A call to Budget_Remaining returns the remaining budget. If the budget
+is exhausted it will return Time_Span_Zero. This is the minimum value
+for the budget. A call to Budget_Has_Expired will return True if the
+budget is exhausted (equal to Time_Span_Zero), otherwise it returns False.
+
+A Group_Budget can have its budget increased by calling Add. A negative
+value for the parameter will reduce the budget, but never below
+Time_Span_Zero.
+
+A call of Replenish with a non positive value of To will causes exception
+Group_Budget_Error to be raised. A call to Add that results in the value
+of the budget going to Time_Span_Zero will cause the handler, if set,
+to be executed.
+
+A call to Set_Handler registers the Handler and returns when GB is set.
+A call to Set_Handler for a Group_Budget that is already set, initially
+clears the Group_Budget then registers the new Handler.
+
+A call to Current_Handler returns with the current Handler.
+If the Group_Budget denoted by GB is not set, exception Group_Budget_Error
+is raised.
+
+A call to Cancel_Handler returns after the Group_Budget denoted by GB
+is cleared. Cancelled is assigned True if GB was set prior to it
+being cleared; otherwise the parameter is assigned False.
+
+The constant Min_Handler_Ceiling is the priority value that will insure that
+no ceiling violation will occur when a handler is executed.
+
+The precision of the accounting of task execution time to a Group_Budget
+is the same as that defined for execution-time clocks from the parent
+package.
+
+As part of the finalization of an object of type Group_Budget all member
+tasks are removed from the group identified by the object.
+
+If a task is a member of a Group_Budget when it terminates then as part of
+the finalization of the task it is removed from the group.
+
+For all the operations and types defined in this package, Tasking_Error
+is raised if the task identified by T has terminated. Program_Error
+is raised if the value of T is Null_Task_ID.
+
+@i<@s8<Implementation Requirements>>
+
+For a given Group_Budget object, the implementation shall perform the
+operations declared in this package atomically with respect to any
+of these operations on the same Group_Budget object.
+
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent