From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,899097ccdbca937b X-Google-Attributes: gid103376,public From: Christoph Grein Subject: Re: Finalization of record components which are tasks Date: 2000/03/03 Message-ID: <200003030559.GAA12395@bulgaria.otn.eurocopter.de>#1/1 X-Deja-AN: 592777039 To: comp.lang.ada@ada.eu.org Content-Type: TEXT/plain; charset=us-ascii Content-MD5: v/gIsQeGgDf7ZsEVsqZxnw== X-Complaints-To: usenet@enst.fr X-Trace: menuisier.enst.fr 952109298 14068 137.194.161.2 (3 Mar 2000 18:48:18 GMT) Organization: ENST, France X-BeenThere: comp.lang.ada@ada.eu.org Mime-Version: 1.0 Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Date: 3 Mar 2000 18:48:18 GMT Newsgroups: comp.lang.ada Date: 2000-03-03T18:48:18+00:00 List-Id: > Does the termination of a task which is a component of a controlled > object really happen *before* the user-defined finalization subprogram > is called? This is really surprising. IMHO, both common sense and > 7.6.1(5) suggest that the task object has to be finalized *after* the > user-defined finalization subprogram has completed. What do you mean by "common sense"? My common sense says what happens is just what I expect. On Rational on Sun, the following happens: Before Start <-- these two statements may Before Task_Type.Start (R) <-- occur in any sequence After Task_Type.Start (R) Before Wait Watcher object finalized Task has terminated Before Wait in finalization Exception in Finalize TASKING_ERROR raised at 16#000E2544#, Exception Message: You have to take into account the notion of a master of the task in question. Your procedure Create_Task is the master in question. It can be left only if if all tasks it is the master of have terminated. Now you have a terminate alternative in you task. This tells the task that it can terminate when there is no more caller around. Your only caller is in fact Create_Task, which is waitinf for termination so there actually is no more caller. So the terminate alternative is chosen, the task terminates. Finalize is called for the terminated task. Now you try to rendezvous with a terminated task, so you get what you reqested. If you comment out the terminate alternative, you'll get deadlock. The task waits on a select statement no-one is around to call. Hope that helps.