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=0.7 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,REPLYTO_WITHOUT_TO_CC autolearn=no 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.36.6 with SMTP id m6mr1619790pbj.4.1322618031611; Tue, 29 Nov 2011 17:53:51 -0800 (PST) Path: lh20ni41018pbb.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: "Rego, P." Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Tue, 29 Nov 2011 17:47:42 -0800 (PST) Organization: http://groups.google.com Message-ID: <12819161.692.1322617663028.JavaMail.geo-discussion-forums@yqbz41> References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> Reply-To: comp.lang.ada@googlegroups.com NNTP-Posting-Host: 187.34.116.252 Mime-Version: 1.0 X-Trace: posting.google.com 1322618031 23405 127.0.0.1 (30 Nov 2011 01:53:51 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 30 Nov 2011 01:53:51 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=187.34.116.252; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu User-Agent: G2/1.0 X-Google-Web-Client: true Xref: news2.google.com comp.lang.ada:14735 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-11-29T17:47:42-08:00 List-Id: > You ought to wait until the task has terminated before freeing it. I > can't trace it now, but I think that AdaCore recently fixed a feature > where the TCB would be silently not deallocated if the task wasn't > terminated. I had to fix this problem by handing off all tasks to be > deallocated by a low-priority task, which required some interesting > generic/codegen manipulation. Maybe could I use procedure Destruct (T : access Test_Class) is T_Ptr : Test_Class_Ptr := Test_Class_Ptr (T); begin T.Primary.Finish; end Destruct; procedure Finalize (Object : in out Test_Class) is T_Ptr : Test_Class_Ptr := Test_Class_Ptr (Object.Primary.This); begin Free (T_Ptr); end Finalize; but this leads to the message "cannot convert access discriminant to non-local access type". So how can I fix this approach?