comp.lang.ada
 help / color / mirror / Atom feed
* Q:finalization or task terminate first?
@ 1997-03-04  0:00 Tom Moran
  1997-03-05  0:00 ` Robert A Duff
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Moran @ 1997-03-04  0:00 UTC (permalink / raw)



Given a package body with a declaration of an object descended from
Ada.finalization.controlled, and also a task with a select-terminate
alternative, when the main program that with's this package reaches its
end, which will happen first: the Finalize call or the task termination?




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Q:finalization or task terminate first?
  1997-03-04  0:00 Q:finalization or task terminate first? Tom Moran
@ 1997-03-05  0:00 ` Robert A Duff
  0 siblings, 0 replies; 2+ messages in thread
From: Robert A Duff @ 1997-03-05  0:00 UTC (permalink / raw)



In article <331CF2F4.6B79@bix.com>, Tom Moran  <tmoran@bix.com> wrote:
>Given a package body with a declaration of an object descended from
>Ada.finalization.controlled, and also a task with a select-terminate
>alternative, when the main program that with's this package reaches its
>end, which will happen first: the Finalize call or the task termination?

Task termination happens first.  Then finalization.  See 7.6.1(4).
In this case, the "master" is the environment task.

This makes sense: you can't finalize things while tasks are still
meddling with them.

See also 10.2(26) and 9.8(20), and note that finalization is
abort-deferred.  And note that all Finalize procedures are library-level
procedures.  These paragraphs ensure that there's no need to await tasks
twice for the same master (that is, once finalization starts for a given
master, all tasks dependent on that master are dead and no more will be
created).

- Bob




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-03-05  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-04  0:00 Q:finalization or task terminate first? Tom Moran
1997-03-05  0:00 ` Robert A Duff

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