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.3 required=5.0 tests=BAYES_00, 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.35.68 with SMTP id f4mr3415390pbj.5.1322037320398; Wed, 23 Nov 2011 00:35:20 -0800 (PST) Path: lh20ni8375pbb.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Wed, 23 Nov 2011 09:35:02 +0100 Organization: cbb software GmbH Message-ID: References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news2.google.com comp.lang.ada:14549 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-11-23T09:35:02+01:00 List-Id: On Tue, 22 Nov 2011 17:50:45 -0800 (PST), Rego, P. wrote: > So now I have a class with a task inside and a Constructor, and I want to implement a destructor. [...] If you have Start and Finish entries, you don't need terminate alternative. Use Ada.Finalization.Limited_Controlled as the base. Make task an access to task component. Initialize should allocate the task. You don't need Start entry at all. (The only use for Start is passing additional parameters to the task) From Finalize you call to Finish and then free the task. The constructing function *shall* not use pointers. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de