comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Delayed deallocation of non-terminated task in Gnat?
Date: Wed, 31 Aug 2011 14:08:26 -0400
Date: 2011-08-31T14:08:26-04:00	[thread overview]
Message-ID: <wccr5413145.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 31ba531d-fa8e-40f3-97bc-c9112b329fe2@14g2000prv.googlegroups.com

Marc C <mc.provisional@gmail.com> writes:

> 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.

Yes.  Ada semantics requires that if you call Unchecked_Deallocation
on an object that contains running tasks, the tasks keep running.

In the old version of GNAT, U_D would say "Is the task terminated?
If so, free up its resources.  If not, do nothing."  So it could
leak memory.

The new version of GNAT is better: "Is the task terminated?
If so, free up its resources.  If not, cause its resources
to be freed up when it does terminate."

But you have to be careful:  Like any U_D, you can have
dangling pointers.

- Bob



      parent reply	other threads:[~2011-08-31 18:08 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
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 [this message]
replies disabled

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