comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Finalization of record components which are tasks
Date: 2000/03/02
Date: 2000-03-02T00:00:00+00:00	[thread overview]
Message-ID: <wccog8x871m.fsf@world.std.com> (raw)
In-Reply-To: tgr9dtixlk.fsf@mercury.rus.uni-stuttgart.de

> Does the termination of a task which is a component of a controlled
> object really happen *before* the user-defined finalization subprogram
> is called?  This is really surprising.  IMHO, both common sense and
> 7.6.1(5) suggest that the task object has to be finalized *after* the
> user-defined finalization subprogram has completed.

I'm too lazy to read all your code, but maybe this will answer the
question:

A task terminates when it's done.  Also, if it is waiting on a terminate
alternative, it terminates when its master is done, and all of the other
tasks dependent on that master are terminated or waiting on terminate
alternatives.  In particular, the termination of a task is *not*
triggered by finalization of the task object.  So 7.6.1(9) is
irrelevant.

When a master (eg a procedure) is done ("completed" is the RM term) it
*first* awaits termination of dependent tasks (and/or causes their
termination if they're waiting on terminate alts).  It *then* finalizes
all of the local objects (and if some of those are tasks, or contain
tasks, then they are necessarily already terminated at that point).
Note that finalization of a task object doesn't do much of anything.

You wouldn't want it to be the other way around: If you first finalize
locals, and then wait for the tasks to terminate, then those tasks would
have the data they're working on ripped out from under them.

There are obscure ways in which programs can see finalized objects, but
this isn't one of them, and that's a good thing.

- Bob





  reply	other threads:[~2000-03-02  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-02  0:00 Finalization of record components which are tasks Florian Weimer
2000-03-02  0:00 ` Robert A Duff [this message]
2000-03-03  0:00 ` Florian Weimer
2000-03-03  0:00   ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
2000-03-03  0:00 Christoph Grein
replies disabled

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