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: Tue, 30 Aug 2011 08:38:52 -0700 (PDT)
Date: 2011-08-30T08:38:52-07:00	[thread overview]
Message-ID: <d46346a2-ad00-4f10-8362-9d098e21abb4@h23g2000pra.googlegroups.com> (raw)
In-Reply-To: 31ba531d-fa8e-40f3-97bc-c9112b329fe2@14g2000prv.googlegroups.com

On Aug 30, 6:22 am, Marc C <mc.provisio...@gmail.com> wrote:
> Saw this pop up in AdaCore's Developer Center notices:
>
> >[GNAT] Automatic deallocation of task upon termination
>
> >Monday August 29, 2011
>
> >If Unchecked_Deallocation is called on a non-terminated task (which was previously a no-op),
> >the task is now marked to be freed automatically when it terminates.
>
> [http://www.adacore.com/2011/08/29/NF-65-H911-007-gnat/]
>
> This *looks* to me like one could dynamically allocate a task instance
> and then immediately free it with an instantiation of
> Unchecked_Deallocation, yet the task would continue to function
> normally until it terminates.
>
> This seems rather a stretch to me, is there more to this than this
> brief summary lets on?

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.  (Note that this applies only to tasks without discriminants.
If the task has discriminants, freeing it is an
error---13.11.2(11ff).)

                                -- Adam



                               -- Adam





  parent reply	other threads:[~2011-08-30 15:38 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 [this message]
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
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