From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Class with task destructor
Date: Thu, 1 Dec 2011 10:25:39 +0100
Date: 2011-12-01T10:25:39+01:00 [thread overview]
Message-ID: <8m4vv17pt6tu.1p143xasxt81v.dlg@40tude.net> (raw)
In-Reply-To: jb6i43$58u$1@munin.nbi.dk
On Wed, 30 Nov 2011 18:35:13 -0600, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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
next prev parent reply other threads:[~2011-12-01 9:26 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 1:50 Class with task destructor Rego, P.
2011-11-23 2:44 ` Adam Beneschan
2011-11-23 5:04 ` Yannick Duchêne (Hibou57)
2011-11-23 6:14 ` Adam Beneschan
2011-11-24 0:15 ` Randy Brukardt
2011-11-24 2:48 ` Adam Beneschan
2011-11-29 3:36 ` Randy Brukardt
2011-11-29 9:31 ` Simon Wright
2011-11-29 15:37 ` Adam Beneschan
2011-11-23 8:35 ` Dmitry A. Kazakov
2011-11-23 9:05 ` Simon Wright
2011-11-23 10:41 ` Dmitry A. Kazakov
2011-11-30 1:11 ` Rego, P.
2011-11-30 2:21 ` Adam Beneschan
2011-11-30 8:41 ` Dmitry A. Kazakov
2011-12-01 0:35 ` Randy Brukardt
2011-12-01 6:28 ` J-P. Rosen
2011-12-01 10:55 ` Simon Wright
2011-12-01 21:48 ` Robert A Duff
2011-12-01 22:44 ` Adam Beneschan
2011-12-02 0:57 ` Randy Brukardt
2011-12-02 5:57 ` J-P. Rosen
2011-12-02 15:07 ` Robert A Duff
2011-12-02 18:41 ` Jeffrey Carter
2011-12-01 9:25 ` Dmitry A. Kazakov [this message]
2011-12-01 1:58 ` Rego, P.
2011-11-30 8:35 ` Simon Wright
2011-11-30 15:36 ` Adam Beneschan
2011-11-30 16:32 ` Robert A Duff
2011-12-01 0:40 ` Randy Brukardt
2011-12-01 8:50 ` Yannick Duchêne (Hibou57)
2011-12-02 0:50 ` Randy Brukardt
2011-12-02 5:30 ` Jeffrey Carter
2011-12-02 16:20 ` Adam Beneschan
2011-12-02 18:01 ` Dmitry A. Kazakov
2011-12-02 18:50 ` Jeffrey Carter
2011-12-02 19:03 ` Adam Beneschan
2011-12-01 10:51 ` Simon Wright
2011-12-01 22:59 ` Simon Wright
2011-12-01 1:59 ` Rego, P.
2011-11-30 1:47 ` Rego, P.
[not found] ` <15090042.1880.1322617401962.JavaMail.geo-discussion-forums@yqkn8>
2011-11-30 8:43 ` Dmitry A. Kazakov
2011-12-01 1:53 ` Rego, P.
2011-12-01 9:28 ` Dmitry A. Kazakov
2011-11-25 2:44 ` Rego, P.
[not found] ` <28489797.1088.1322188495508.JavaMail.geo-discussion-forums@yqf20>
2011-11-25 9:19 ` Dmitry A. Kazakov
2011-11-29 3:40 ` Randy Brukardt
2011-11-23 10:26 ` Brian Drummond
2011-11-25 1:37 ` Rego, P.
2011-11-25 13:40 ` Brian Drummond
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox