From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: Fri, 19 Jul 91 09:22:16 EDT From: "Norman H. Cohen" Subject: Re: Task Access Type Variables Message-ID: <9107191345.AA26383@ajpo.sei.cmu.edu> List-Id: > What happens to the value of a variable which > is an access to a task (type) once the task completes > its job or terminates for some reason? > > Does this access type variable become NULL or > will it access some garbage location? It continues to be a valid pointer to a task object. The task object just happens to designate a terminated task. (This is no different from what happens to a DECLARED task object when the task terminates. The task object continues to exist.) > I could just use the TVAR.all'CALLABLE or > TVAR.all'TERMINATED task attributes to see what the > status of the task that TVAR points to is. (Of > course, I'll check to make sure that TVAR /= null > before I do this). Indeed. Calling an entry of a terminated task will raise TASKING_ERROR, but one thing you CAN do with a task object designating a terminated task is to evaluate its 'CALLABLE and 'TERMINATED attributes. This is why a task OBJECT must stay around even after the TASK it designates has terminated. (Remember: A "task" is a process. A "task object" is a variable that "designates" that process and holds certain information about it, including whether the process has terminated.) There is no need to check that TVAR /= null. Termination of a task does not trigger a search for all variables holding pointers to the corresponding task object so that those variables can be set to null! > Also...can garbage collection be done on task access > type variables? This seems like it shouldn't be possible. I think you're asking whether dynamically allocated task objects (rather than pointers to task objects) can be garbage collected. The answer is yes, provided that two conditions hold: 1. The object is no longer reachable by a chain of active pointers (i.e., it is "garbage" in the usual sense). 2. The designated task has terminated. (See paragraph 4.8(7) in the reference manual.) Of course no Ada compiler yet provides garbage collection for ANY types, let alone task types.