comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How to tell whether program finalization can be suppressed
Date: Fri, 1 Dec 2017 16:43:23 -0600
Date: 2017-12-01T16:43:23-06:00	[thread overview]
Message-ID: <ovslub$ajk$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: lyzi729lh2.fsf@pushface.org

"Simon Wright" <simon@pushface.org> wrote in message 
news:lyzi729lh2.fsf@pushface.org...
...
> 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 don't know enough about the details of GNAT to say anything useful about 
it specifically, but the above seems confused from an Ada perspective. When 
the main program exits, of course the environment task completes and then 
terminates. It's the completion of the environment task that starts 
library-level finalization. (Indeed, you can use Ada.Task_Identification to 
figure out that this is happening -- that is how Claw shuts down its tasks, 
otherwise they would wait forever for operations that aren't ever going to 
happen.) The termination of the environment tasks causes the entire program 
to exit (normally or via exception).

In an embedded system that is supposed to run forever, one would expect that 
the main subprogram would never exit. If it did exit, the system would shut 
itself off, which probably would lead to task waiting and then library-level 
finalization. After that, one would try to restart the system from scratch. 
I suppose someone could build a system that did something else on such an 
exit (which always represents a catostrophic failure), but it wouldn't be 
very Ada-like - finalization would not get performed on objects that are 
expecting that (potentially leaving things in unusual states). Such a system 
would have to start-up making no assumptions at all, even the ones that 
usually could be made at power-up -- which sounds painful.

                                         Randy.


  reply	other threads:[~2017-12-01 22:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 21:39 How to tell whether program finalization can be suppressed Simon Wright
2017-12-01 22:43 ` Randy Brukardt [this message]
2017-12-02  9:48   ` Simon Wright
2017-12-04 20:18     ` Randy Brukardt
2017-12-04 22:41     ` Simon Wright
2017-12-02 11:12   ` AdaMagica
2017-12-03 17:16     ` Robert Eachus
2017-12-04 11:58       ` AdaMagica
2017-12-04 14:36         ` Robert Eachus
2017-12-04 17:16           ` AdaMagica
2017-12-04 18:21             ` Jeffrey R. Carter
2017-12-04 20:25             ` Randy Brukardt
2017-12-04 20:22         ` Randy Brukardt
2017-12-02  3:08 ` Robert Eachus
2017-12-27 15:49 ` Simon Wright
replies disabled

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