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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4bd6ca8f7a1eb225 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.31.165 with SMTP id b5mr1245266pbi.1.1322776135298; Thu, 01 Dec 2011 13:48:55 -0800 (PST) Path: lh20ni53896pbb.0!nntp.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Thu, 01 Dec 2011 16:48:54 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> <24938373.1788.1322615481874.JavaMail.geo-discussion-forums@yqjo5> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1322776134 17415 192.74.137.71 (1 Dec 2011 21:48:54 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 1 Dec 2011 21:48:54 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:iwHPi7wZCECJC5EZGLOaqvoQWHM= Xref: news2.google.com comp.lang.ada:14779 Content-Type: text/plain; charset=us-ascii Date: 2011-12-01T16:48:54-05:00 List-Id: "J-P. Rosen" writes: > Put an entry (say "Termination_Wait") in the waited task, and never > accept it. Call Termination_Wait from the waiting task. When the waiting > task receives Tasking_Error, the waited task is terminated (well, > completed, but that should be close enough). I don't think it's close enough. It is impossible to actually free things before the task is really terminated. The task is doing finalization between completion and termination, and that could refer to discriminants. And even if there's no finalization present, the task is still using its stack, which had better not be freed. So there's still a race condition. Luckily, in the latest version of GNAT, if you call U_D on an object containing tasks, it will get freed. If the task happens to be already terminated, it will get freed immediately. Otherwise, it will get freed when the task does terminate. But this is not required by the RM. - Bob