From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ee06257af909a235 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!u30g2000hsc.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Finalization of static package variables Date: 16 May 2007 07:06:50 -0700 Organization: http://groups.google.com Message-ID: <1179324410.556097.234870@u30g2000hsc.googlegroups.com> References: <4640f20b$1@news.upm.es> <1178723724.958486.24820@u30g2000hsc.googlegroups.com> <464244d8$1@news.upm.es> <1178753228.648765.89390@e65g2000hsc.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1179324422 16074 127.0.0.1 (16 May 2007 14:07:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 16 May 2007 14:07:02 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: u30g2000hsc.googlegroups.com; posting-host=66.126.103.122; posting-account=cw1zeQwAAABOY2vF_g6V_9cdsyY_wV9w Xref: g2news1.google.com comp.lang.ada:15812 Date: 2007-05-16T07:06:50-07:00 List-Id: On May 15, 5:36 pm, "Randy Brukardt" wrote: > "Adam Beneschan" wrote in message > > news:1178753228.648765.89390@e65g2000hsc.googlegroups.com... > On May 9, 3:00 pm, Manuel Collado wrote: > > > Adam Beneschan escribi=F3: > > Well, JEWL uses tasks internally. So, who knows... > > > 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). > > > The fact is that there is a significant difference in behaviour between > > variables in the main procedure and static package variables. Example: > > This sounds awfully familiar to me; it's a problem that we had in Claw. T= he > problem you're having appears to be that the library you arer using (JEWL) > does not properly support library-level objects. We had a lot of trouble > with this in Claw, in the end we found a trick to determine when the > environment task is completing; then we have the main task forcibly > close/finalize all open windows. So, to go back to a point I briefly mentioned in my previous post: does Ada need a feature that would allow you to call your own finalization procedure or something when the environment task is completing, so that you don't have to do this using trickery? Maybe something like: package Ada.Finalization.Environment is type Finalization_Proc is access procedure; procedure At_Environment_Task_Completion (Proc : in Finalization_Proc); end Ada.Finalization.Environment; Then, the body of the "Environment_Task" implicit task would call the main subprogram and then call any procedures registered with At_Environment_Task_Completion, in arbitrary order; you could possibly add an exception handler to the Environment_Task body to call the finalization procedures too. That would be a simple way to solve this sort of problem without adding any language syntax. -- Adam