CVS difference for ais/ai-10266.txt

Differences between 1.12 and version 1.13
Log of other versions for file ais/ai-10266.txt

--- ais/ai-10266.txt	2004/02/21 04:15:11	1.12
+++ ais/ai-10266.txt	2004/07/27 23:01:08	1.13
@@ -1,6 +1,8 @@
-!standard D.2.2 (5)                                04-02-10  AI95-00266-02/06
+!standard D.2.2 (5)                                04-06-25  AI95-00266-02/07
 !standard D.7 (00)
 !class amendment 01-06-01
+!status Amendment 200Y 04-06-25
+!status ARG Approved 6-1-2  04-06-13
 !status work item 01-06-01
 !status received 01-06-01
 !priority High
@@ -15,7 +17,7 @@
 If a task terminates due to an unhandled exception, the exception occurrence
 is passed as a parameter to the procedure. The proposal provides an alternative
 to that of AI95-00266-01 which was rejected by IRTAW11; it responds to earlier
-comments by the ARG. The proposal here introduces default handlers for task
+comments by the ARG. The proposal here introduces fall-back handlers for task
 hierarchies, but does not go as far as task groups.
 
 !problem
@@ -48,27 +50,27 @@
   type Cause_Of_Termination is (Normal, Abnormal, Unhandled_Exception);
 
   type Handler is access protected procedure(
-    Cause : Cause_Of_Termination;
-    T : Ada.Task_Identification.Task_Id;
-    X : Ada.Exceptions.Exception_Occurrence);
+      Cause : in Cause_Of_Termination;
+      T : in Ada.Task_Identification.Task_Id;
+      X : in Ada.Exceptions.Exception_Occurrence);
 
-  procedure Set_Dependents_Default_Handler(New_Handler: in Handler);
-  function Own_Default_Handler(Current_Handler: out Handler);
+  procedure Set_Dependents_Fallback_Handler(New_Handler: in Handler);
+  function Current_Task_Fallback_Handler return Handler;
 
-  procedure Set_Specific_Handler(T : Ada.Task_Identification.Task_Id;
+  procedure Set_Specific_Handler(T : in Ada.Task_Identification.Task_Id;
                         New_Handler : in Handler);
-  function Specific_Handler(T : Ada.Task_Identification.Task_Id;
-                        Current_Handler: out Handler);
+  function Specific_Handler(T : Ada.Task_Identification.Task_Id)
+      return Handler;
 end Ada.Task_Termination;
 
 Dynamic Semantics
 
-A call of Set_Dependents_Default_Handler sets the default handler
-for all dependent tasks. If a default handler had previously been
+A call of Set_Dependents_Fallback_Handler sets the fall-back handler
+for all dependent tasks. If a fall-back handler had previously been
 set it is replaced. A call with a null access parameter is
-equivalent to removing the default handler. A call of
-Own_Default_Handler returns the default handler that is currently
-in effect for the calling task. If no default handler has been set
+equivalent to removing the fall-back handler. A call of
+Current_Task_Fallback_Handler returns the fall-back handler that is currently
+in effect for the calling task. If no fall-back handler has been set
 it returns null.
 
 A call of Set_Specific_Handler sets a specific handler for the
@@ -80,20 +82,20 @@
 
 As part of the finalization of a task_body, after performing the actions
 specified in 7.6 for finalization of a master, the task specific handler,
-if not null, is called. If there is no such specific handler, a default
-handler is determined by recursively searching for a non null default
-handler in the tasks upon which it depends. If such a default handler
+if not null, is called. If there is no such specific handler, a fall-back
+handler is determined by recursively searching for a non null fall-back
+handler in the tasks upon which it depends. If such a fall-back handler
 is determined it is executed; otherwise no handler is executed.
 
-If the task terminated due to completing the last statement
+If the task completed due to completing the last statement
 of the task body, or as a result of waiting on a terminate
 alternative then Cause is set to Normal and X is set to Null_Occurrence.
-If termination is due to abort then Cause is set
-to Abnormal and X is set to Null_Occurrence. If termination is
+If completion is due to abort then Cause is set
+to Abnormal and X is set to Null_Occurrence. If completion is
 due to an unhandled exception then Cause is set to Unhandled_Exception
 and the associated exception occurrence is passed.
 
-For all the operations and types defined in this package, Tasking_Error
+For all the operations defined in this package, Tasking_Error
 is raised if the task identified by T has already terminated. Program_Error
 is raised if the value of T is Null_Task_ID.
 
@@ -122,19 +124,20 @@
 before execution in a Ravenscar environment would cause the program to fail
 and the problem would need to be handled at a different level.
 
-This proposal allows defaults (for the active partition) to be assigned
-for all tasks; or per-task handlers to be set. It does not attempt to
-define task groups. But a default is for all dependent tasks. Hence setting
-the default for the environment task will cover all tasks in the partition.
+This proposal allows fall-back handlers (for the active partition) to be
+assigned for all tasks; or per-task handlers to be set. It does not attempt to
+define task groups. But a fall-back handler is used for all dependent tasks.
+Hence setting the fall-back handler for the environment task will cover all
+tasks in the partition.
 
 With a task hierarchy two programming styles are possible. The first
-involves replacing the default for a part of the tree - this is directly
-supported by the proposal. The second involves adding to the existing
-default - this can be programmed by first getting the original default
-and then creating a new handler that incorporates the new functionality
-plus a call to the original handler.
+involves replacing the fall-back handler for a part of the tree - this is
+directly supported by the proposal. The second involves adding to the existing
+fall-back handler - this can be programmed by first getting the original
+fall-back handler and then creating a new handler that incorporates the
+new functionality plus a call to the original handler.
 
-If a null default handler is set then this is equivalent to there being
+If a null fall-back handler is set then this is equivalent to there being
 no handler.
 
 The requirement is that the user-supplied protected subprogram is usually
@@ -197,13 +200,85 @@
     task body Guardian is ...
   end Logger;
 begin
-  Set_Dependents_Default_Handler(Logger.Log_Termination'Access);
+  Set_Dependents_Fallback_Handler(Logger.Log_Termination'Access);
   Set_Specific_Handler(Current_Task, Logger.Output'Access);
 end Termination_Logging;
 
-!discussion
+!corrigendum C.7.3(01)
+
+@dinsc
+
+This clause specifies a package for associating protected procedures
+with a task. One such procedure is invoked when the task is about to
+terminate.
+
+@i<@s8<Static Semantics>>
+
+The following language-defined library package exists:
+
+@xcode<@b<with> System;
+@b<with> Ada.Task_Identification;
+@b<with> Ada.Exceptions;
+@b<package> Ada.Task_Termination @b<is>
+  @b<type> Cause_Of_Termination @b<is> (Normal, Abnormal, Unhandled_Exception);
+
+  @b<type> Handler @b<is access protected procedure>(
+      Cause : @b<in> Cause_Of_Termination;
+      T     : @b<in> Ada.Task_Identification.Task_Id;
+      X     : @b<in> Ada.Exceptions.Exception_Occurrence);
+
+  @b<procedure> Set_Dependents_Fallback_Handler(New_Handler: @b<in> Handler);
+  @b<function> Current_Task_Fallback_Handler return Handler;
+
+  @b<procedure> Set_Specific_Handler(
+      T           : @b<in> Ada.Task_Identification.Task_Id;
+      New_Handler : @b<in> Handler);
+  function Specific_Handler(T : Ada.Task_Identification.Task_Id)
+      @b<return> Handler;
+@b<end> Ada.Task_Termination;>
 
+@i<@s8<Dynamic Semantics>>
+
+A call of Set_Dependents_Fallback_Handler sets the fall-back handler
+for all dependent tasks. If a fall-back handler had previously been
+set it is replaced. A call with a null access parameter is
+equivalent to removing the fall-back handler. A call of
+Current_Task_Fallback_Handler returns the fall-back handler that is currently
+in effect for the calling task. If no fall-back handler has been set
+it returns null.
+
+A call of Set_Specific_Handler sets a specific handler for the
+task identified by T. If a specific handler had previously been set
+it is replaced. A call with a null access parameter is equivalent
+to removing the specific handler. A call of Specific_Handler returns
+the specific handler if one has been set, otherwise the handler
+returned is null.
+
+As part of the finalization of a task_body, after performing the actions
+specified in 7.6 for finalization of a master, the task specific handler,
+if not null, is called. If there is no such specific handler, a fall-back
+handler is determined by recursively searching for a non null fall-back
+handler in the tasks upon which it depends. If such a fall-back handler
+is determined it is executed; otherwise no handler is executed.
+
+If the task completed due to completing the last statement
+of the task body, or as a result of waiting on a terminate
+alternative then Cause is set to Normal and X is set to Null_Occurrence.
+If completion is due to abort then Cause is set
+to Abnormal and X is set to Null_Occurrence. If completion is
+due to an unhandled exception then Cause is set to Unhandled_Exception
+and the associated exception occurrence is passed.
+
+For all the operations defined in this package, Tasking_Error
+is raised if the task identified by T has already terminated. Program_Error
+is raised if the value of T is Null_Task_ID.
+
+An exception propagated from a handler that is invoked as part of
+a task's termination has no effect.
+
 !ACATS test
+
+ACATS test(s) need to be constructed for this feature.
 
 !appendix
 

Questions? Ask the ACAA Technical Agent