CVS difference for ai05s/ai05-0005-1.txt
--- ai05s/ai05-0005-1.txt 2010/01/21 05:29:15 1.29
+++ ai05s/ai05-0005-1.txt 2010/02/23 07:31:05 1.30
@@ -2050,6 +2050,42 @@
****************************************************************
+!topic Ada.Task_Termination and environment task
+!reference C.7.3, 10.2(11-12)
+!from Adam Beneschan 09-11-23
+!discussion
+
+The semantics of Ada.Task_Termination seem to make it possible to call
+Set_Specific_Handler on the environment task, e.g. by using this
+
+ Ada.Task_Termination.Set_Specific_Handler
+ (Ada.Task_Identification.Current_Task,
+ Prot_Object.Handler'access);
+
+in the main program.
+
+However, it appears to me that such a handler can never be successfully
+executed---or, at least, it is a bounded error to do so, since C.7.3(14/2)
+says that the handler is executed after other finalizations for the task are
+executed, and 10.2(11-12) implies that for the environment task, all
+library-level objects will be finalized, which includes all protected objects,
+which means that calling the termination handler is necessarily calling a
+protected subprogram of a protected object that has been finalized. Maybe
+this will work and maybe it won't (9.4(20.1/2)).
+
+This concerns me because I think the above call is something that someone is
+bound to try, since it seems like it would be a neat way to get something to
+happen when the environment task exits (perhaps due to an unhandled exception),
+but it's going to bite them.
+
+I believe that perhaps C.7.3 should clarify what happens when
+Set_Specific_Handler is called on the environment task (maybe in the Notes
+section), or perhaps the dynamic semantics should be changed to make
+Set_Specific_Handler raise a Program_Error if the task ID refers to the
+environment task.
+
+****************************************************************
+
From: Dan Eilers
Sent: Saturday, January 9, 2010 5:44 PM
Questions? Ask the ACAA Technical Agent