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.0.170 with SMTP id 10mr10851934pbf.2.1322212791218; Fri, 25 Nov 2011 01:19:51 -0800 (PST) Path: lh20ni15921pbb.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!news.tornevall.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Fri, 25 Nov 2011 10:19:29 +0100 Organization: cbb software GmbH Message-ID: <1hi4mzlr17z6m.1t1rj0maa8vmt.dlg@40tude.net> References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> <28489797.1088.1322188495508.JavaMail.geo-discussion-forums@yqf20> 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:14632 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-11-25T10:19:29+01:00 List-Id: On Thu, 24 Nov 2011 18:34:55 -0800 (PST), Rego, P. wrote: >> 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. > > 1) Why should I need to use Finalize (instead of direct T.Primary.Finish in Destruct)? Because Finalize is always called when the object is being finalized. > because in the first cycle the Some_Info was not initialized. Because you have to fix the constructing function to return the object rather than a pointer. Then you have to ensure that objects cannot be created otherwise than initialized by that function. > Maybe I misunderstand when you said to take out Start entry? The task should be paused initially and first released by the constructing function. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de