comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Delayed deallocation of non-terminated task in Gnat?
Date: Wed, 31 Aug 2011 09:39:08 -0700 (PDT)
Date: 2011-08-31T09:39:08-07:00	[thread overview]
Message-ID: <c03bf799-1f02-4042-8207-599e0af75dc6@w22g2000prj.googlegroups.com> (raw)
In-Reply-To: d46346a2-ad00-4f10-8362-9d098e21abb4@h23g2000pra.googlegroups.com

On Aug 30, 8:38 am, Adam Beneschan <a...@irvine.com> wrote:

> I think this is right---the task continues to function until it
> terminates.  The only way to get a task to stop executing before it
> completes is to abort it (via an abort statement, or other semantics
> that cause an abort---see 9.8).  An Unchecked_Deallocation instance
> finalizes the task object, but the semantics of finalization don't
> involve aborting.  I'm having a bit of difficulty figuring out from
> the RM what the exact semantics of finalizing an unterminated task
> object are, but I'm pretty sure that aborting the task is not one of
> them.

Actually, I just found this in the Ada 83 manual (13.10.1(8)):

"If X designates a task object, the call FREE(X) [where FREE is an
instance of Unchecked_Deallocation] has no effect on the task
desginated by the value of the task object.  The same holds for any
subcomponent of the object designated by X, if this subcomponent is a
task object."

This language got dropped in Ada 95, but I think it was intended that
these still be the semantics, for a task without discriminants (Ada 83
did not allow task discriminants).  I'm not sure why the language was
omitted; it could have just been inadvertent (I've seen one or two
other cases where RM83 language got lost and left some things
undefined that should have been defined), or the authors could have
felt that it was no longer necessary because of other wording changes,
particularly those dealing with finalization.  The latter could be
correct, although I've been having trouble finding RM language that
made it clear that this was supposed to happen.  The current RM does
say that "if the object being freed contains tasks, the object might
not be deallocated", but this doesn't clearly say anything about what
happens to the task.

One thing that bothers me a bit, although I don't know if it bothers
me enough to request an RM change: 13.11.2(10) says that after
Free(X), the designated object and its subcomponents no longer exist.
9.1(15-18) says that the content of a task object includes entry
queues for the task.  I'm willing to accept that there is a
distinction between a task object and a task (or a task execution),
but if the task object no longer exists, does that mean that the entry
queues that it contains no longer exist, and that therefore if another
task Y was waiting on X.all's entry when X was freed, so that the
entry queue on which Y was sitting no longer exists, does Y's entry
call get cancelled?  Again, I don't think this is the intent, but I'm
not sure.

                           -- Adam



  parent reply	other threads:[~2011-08-31 16:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 13:22 Delayed deallocation of non-terminated task in Gnat? Marc C
2011-08-30 15:20 ` Dmitry A. Kazakov
2011-08-31 18:12   ` Robert A Duff
2011-08-31 19:23     ` Dmitry A. Kazakov
2011-08-31 20:58       ` Robert A Duff
2011-08-31 21:16         ` Jeffrey Carter
2011-08-31 20:25     ` J-P. Rosen
2011-08-31 21:09       ` Robert A Duff
2011-08-31 21:53         ` Simon Wright
2011-08-30 15:38 ` Adam Beneschan
2011-08-30 16:42   ` Dmitry A. Kazakov
2011-08-30 18:57     ` Niklas Holsti
2011-08-30 19:23       ` Dmitry A. Kazakov
2011-08-31 16:39   ` Adam Beneschan [this message]
2011-08-31 18:21     ` Robert A Duff
2011-08-31 23:28       ` Adam Beneschan
2011-09-01 11:58         ` Robert A Duff
2011-08-31 20:30     ` J-P. Rosen
2011-08-31 22:36       ` Adam Beneschan
2011-09-01  5:24         ` J-P. Rosen
2011-08-31 18:08 ` Robert A Duff
replies disabled

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