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.11.9 with SMTP id m9mr2066601pbb.1.1322731597549; Thu, 01 Dec 2011 01:26:37 -0800 (PST) Path: lh20ni50305pbb.0!nntp.google.com!news1.google.com!goblin1!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: Thu, 1 Dec 2011 10:25:39 +0100 Organization: cbb software GmbH Message-ID: <8m4vv17pt6tu.1p143xasxt81v.dlg@40tude.net> References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> <24938373.1788.1322615481874.JavaMail.geo-discussion-forums@yqjo5> 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: news1.google.com comp.lang.ada:19283 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-12-01T10:25:39+01:00 List-Id: On Wed, 30 Nov 2011 18:35:13 -0600, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:ey516bovprzb$.1tjszfc528chj$.dlg@40tude.net... > ... >> Not a feature, rather a plain language design bug. Unchecked_Deallocation >> shall wait for the object's finalization. Finalization of a task evidently >> includes its termination. So Unchecked_Deallocation must block until >> termination before it frees anything. > > The problem here is that finalization and task termination are different > operations according to the language, and task termination generally has to > be done first. This was done, I believe, so that any running task does not > have to worry about having the objects it accesses finalized. The problem is that task as an object must be destroyed in exactly this order: 1. terminated 2. finalized (destructed) 3. deallocated What you meant is how finalization of an object having task as a component is composed, i.e. at which stages of the enclosing object destruction and deallocation the positions 1, 2, 3 occur. That is a different issue, but under any circumstances the order 1,2,3 may not change. Unchecked_Deallocation violates this order => must be fixed independently on anything else. > Switching the order of task waiting and finalization would have worked in > this case, but it wouldn't work in general as the library tasks would then > be accessing global objects that have been finalized. Which seems worse than > the original problem. If you mean finalization of the enclosing object, then yes. I can only reiterate that Ada should have proper constructors and destructors. > Point is that all of these things are interelated, and it isn't always > possible to make all of them perfect. (Tucker Taft calls this "moving the > bump under the carpet"; you can move it around to different locations, but > you can't get rid of it without tearing out the carpet. That happens a lot > more often in language design than most people think.) 1. The construction/destruction model must be sanitized. 2. The Rosen's must be restricted. It is inconsistent for a component to refer to an enclosing object upon construction/destruction. There are two alternatives: either to forbid such access discriminants altogether, or else make them inaccessible on the contexts of the constructor/destructor. [Initialize/Finalize are not proper constructor/destructor anyway, so they could be left as obsolete] -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de