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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.149.140 with SMTP id x134mr8285430iod.65.1512184138097; Fri, 01 Dec 2017 19:08:58 -0800 (PST) X-Received: by 10.157.5.211 with SMTP id 77mr347777otd.0.1512184137980; Fri, 01 Dec 2017 19:08:57 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!193no1066375itr.0!news-out.google.com!s63ni466itb.0!nntp.google.com!193no1066373itr.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 1 Dec 2017 19:08:57 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8303:2100:1cec:c0e3:c185:491d; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8303:2100:1cec:c0e3:c185:491d References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <09af341f-059f-47c9-809d-14eda9da2352@googlegroups.com> Subject: Re: How to tell whether program finalization can be suppressed From: Robert Eachus Injection-Date: Sat, 02 Dec 2017 03:08:58 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:49318 Date: 2017-12-01T19:08:57-08:00 List-Id: On Friday, December 1, 2017 at 4:39:24 PM UTC-5, Simon Wright wrote: =20 > I need to find a way of determining whether the RTS actually needs > program-level finalization (that is, finalization called on program > exit), because that's where the bad code is generated. >=20 > Clearly, if the program never exits, there will be no need for > program-level finalization. >=20 > Amongst other things, I can test for specific restrictions, and I'm > wondering whether No_Task_Termination would be appropriate for this? > (I'm assuming that the environment task mustn't terminate, even if the > main program exits; and in this RTS, exceptions can't be propagated). I have some programs where all the work is done in worker tasks, and the ma= in program just needs to stay around until they all finish. What I always = seem to end up with, because I need some way of determining that the progra= m is finished is something like this: procedure Main is begin --get a timestamp, and print out that the program is running. --fire off lots of library-level tasks, don't want them to depend on --the main program. declare task Monitor is entry Killer; end Monitor; =20 task body Monitor is begin select accept Killer; or terminate; end select; end Monitor; end; -- print a timestamp... end Main; The worker tasks don't include terminate alternatives, they only call Kille= r in extreme error cases like can't open data file, network errors, etc. W= hen the last library level task goes away, the terminate alternative is sel= ected. Sounds like this sort of structure would avoid your bug.