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.16.106 with SMTP id f10mr5739581pbd.8.1322787521598; Thu, 01 Dec 2011 16:58:41 -0800 (PST) MIME-Version: 1.0 Path: lh20ni54821pbb.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!news.tornevall.net!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Thu, 1 Dec 2011 18:57:22 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> <24938373.1788.1322615481874.JavaMail.geo-discussion-forums@yqjo5> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1322787444 12267 69.95.181.76 (2 Dec 2011 00:57:24 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 2 Dec 2011 00:57:24 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news1.google.com comp.lang.ada:19300 Date: 2011-12-01T18:57:22-06:00 List-Id: "Robert A Duff" wrote in message news:wccliqwdku1.fsf@shell01.TheWorld.com... > "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. I agree, but I note that J-P's suggestion at least provides a way to delay polling until the task is completed. Most tasks don't have complex finalization, so they don't have to stay for a long time in the completed state. (Although I'd have to go look up the exact details as to when a completed task becomes terminated. I'll note that I became aware of this need to poll for 'Terminated because of various bug reports on ACATS tests involving tasks. Several of them had to be fixed by adding such polling before checking the results of the test. (And a lot of them already had such polling.) It's hard to avoid in Ada as it stands. Randy.