comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Problem with task component
Date: Wed, 19 Sep 2012 21:40:40 +0100
Date: 2012-09-19T21:40:40+01:00	[thread overview]
Message-ID: <m2a9wl4ugn.fsf@pushface.org> (raw)
In-Reply-To: 1667b8e2qt7ei$.1gg1h3hrp9amz$.dlg@40tude.net

(Thanks also to Adam for helpful discussion)

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On Wed, 19 Sep 2012 19:22:07 +0100, Simon Wright wrote:
>
>> If a Limited_Controlled type has a component of a task type, is it
>> wrong to call an entry of the task from Initialize?
>
> Right, this is mandated by 7.6(12), because the alternative is much
> worse, in presence of class-wide access discriminant to the container,
> which most people want.

Not sure I need class-wide, will think about it. Thanks for the
suggestion.

> The simple rule is that you should never ever have task components
> which you need to communicate to upon initialization and/or
> finalization.
>
> Always use pointers to tasks. But doing so, you should be extremely
> careful preventing dispatch in the task body during these
> actions. Which is the rationale for 7.6(12).

Also, it seems to me that if I don't use pointers I'm going to have
trouble finalizing the object: the contained task is sitting there and
prevents leaving the scope in which its containing object is declared,
so the containing object doesn't get finalized and there's no
opportunity for Finalize to tell the task to stop. (And wait until it's
actually terminated before deallocating it. I know that AdaCore have
fixed the feature where deallocating a task that hasn't yet terminated
silently leaves the TCB allocated; does anyone know which FSF GCCs/GNATs
this fix has made it into?)



  reply	other threads:[~2012-09-19 20:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 18:22 Problem with task component Simon Wright
2012-09-19 18:48 ` Dmitry A. Kazakov
2012-09-19 20:40   ` Simon Wright [this message]
2012-09-19 21:11     ` Dmitry A. Kazakov
2012-09-19 21:48       ` Simon Wright
2012-09-24  5:28         ` J-P. Rosen
2012-09-24  8:23           ` Simon Wright
2012-09-24 13:37             ` J-P. Rosen
2012-09-24 14:17               ` Simon Wright
2012-09-24 17:53               ` Robert A Duff
2012-09-24 20:40                 ` J-P. Rosen
2012-09-24 15:44             ` Adam Beneschan
2012-09-24 16:13               ` AdaMagica
2012-09-24 16:43                 ` Adam Beneschan
2012-09-24 16:29               ` Dmitry A. Kazakov
2012-09-24 20:49                 ` J-P. Rosen
2012-09-25  7:35                   ` Dmitry A. Kazakov
2012-09-25 17:52                     ` J-P. Rosen
2012-09-25 18:35                       ` Dmitry A. Kazakov
2012-09-25 19:22                         ` J-P. Rosen
2012-09-26  7:27                           ` Dmitry A. Kazakov
2012-09-26 11:49                             ` Georg Bauhaus
2012-09-26 14:13                               ` Dmitry A. Kazakov
2012-09-19 19:44 ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox