comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Finalization of static package variables
Date: 9 May 2007 08:15:25 -0700
Date: 2007-05-09T08:15:25-07:00	[thread overview]
Message-ID: <1178723724.958486.24820@u30g2000hsc.googlegroups.com> (raw)
In-Reply-To: <uwszio1b7.fsf@stephe-leake.org>

On May 9, 1:20 am, Stephen Leake <stephen_le...@stephe-leake.org>
wrote:
> Manuel Collado <m.coll...@lml.ls.fi.upm.es> writes:
> > Variables declared in the global scope of a package body seem not to
> > be finalized automatically at the end of the whole program (using GNAT
> > 3.15p on WindowsXP).
>
> Is there some reason you are not using a more current version of GNAT?
>
> > If some of these variables contain certain GUI stuff, the program
> > remains as a zombie process after the main procedure termination.
>
> Technically, that cannot be true; the "main procedure" is the
> "environment task", and it does not "terminate" (in the Ada definition
> of that word) until all of the tasks it has spawned have "terminated".
>
> I think that what you are saying is that there are some tasks that
> have not terminated when the main procedure is ready to terminate, and
> that in fact those tasks never terminate.

Except that Manuel never said he was using tasks.  I'm envisioning
that he probably has a controlled object whose initialization causes
some Windows process to be spawned (either directly or via some
function in some other GUI library), and finalization causes the
process to be terminated.


> If the type of the variable is derived from
> Ada.Finalization.Controlled or Limited_Controlled, it will be
> finalized when it goes out of scope. Otherwise, it won't be.
>
> However, a static package variable never goes out of scope, so that is
> no help.

No, I believe that all objects, including static package variables
*and* including allocated objects that have not yet been deallocated,
are supposed to be finalized when the environment task completes.
10.2(25), 7.6.1(10).

                                 -- Adam





  reply	other threads:[~2007-05-09 15:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08 21:55 Finalization of static package variables Manuel Collado
2007-05-09  8:13 ` Alex R. Mosteo
2007-05-09  8:20 ` Stephen Leake
2007-05-09 15:15   ` Adam Beneschan [this message]
2007-05-09 16:01     ` Markus E Leypold
2007-05-09 22:00     ` Manuel Collado
2007-05-09 23:27       ` Adam Beneschan
2007-05-10  4:52         ` Jeffrey R. Carter
2007-05-16  0:41           ` Randy Brukardt
2007-05-10  8:16         ` Alex R. Mosteo
2007-05-16  0:36         ` Randy Brukardt
2007-05-16 14:06           ` Adam Beneschan
2007-05-16 16:47             ` Jeffrey R. Carter
2007-05-16 19:10             ` Randy Brukardt
2007-05-22  4:41               ` christoph.grein
2007-05-22  6:25                 ` tmoran
2007-05-22 22:19                   ` Randy Brukardt
2007-05-10 10:57       ` Stephen Leake
2007-05-09 22:19   ` Manuel Collado
2007-05-10  5:38     ` AW: " Grein, Christoph (Fa. ESG)
2007-05-10 10:55     ` Stephen Leake
2007-05-11 18:12       ` Manuel Collado
2007-05-11 18:26         ` Robert A Duff
2007-05-12 19:17           ` Finalization of static package variables - summary Manuel Collado
2007-05-16  0:49             ` Randy Brukardt
replies disabled

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