comp.lang.ada
 help / color / mirror / Atom feed
From: emery@gypsy.UUCP
Subject: Re: Propagation of exceptions raised wit
Date: Wed, 4-Jun-86 10:13:00 EDT	[thread overview]
Date: Wed Jun  4 10:13:00 1986
Message-ID: <38000028@gypsy.UUCP> (raw)
In-Reply-To: 325@cernvax.UUCP



I think you are asking "Why don't exceptions propogate out of tasks?"
If so, don't feel bad, I asserted that they do once in public, and 
was quickly corrected.  

Exceptions do not propogate out of tasks.  If a task raises an exception
that it doesn't handle, the task becomes 'completed', but no further
action (including propogating the exception) takes place.

Quotes from the Canon:  Ada RM, section 11.4.1

"If an exception is raised in the sequence of statements of a frame that
does not have a handler for the exception, execution of the sequence
of statements is abandoned.  The next action depends on the nature of the
frame:

(a)  For a subprogram body, the same exception is raised again at the
point of call of the subprogram, unless the subprogram is the main
program itself, in which case execution of the main program is abandoned.

(b)  For a block statement, the same exception is raised again immediately
after the block statement (that is, within the innermost enclosing frame
or accept statement).

(c)  For a package body that is a declaritive item, the same exception
is raised again immediately after this declarative item (within the
enclosing declarative part).  If the package body is that of a subunit,
the exception is raised again at the place of the corresponding body
stub.  If the package is a library unit, execution of the main program
is abandoned.

(d)  For a task body, the task becomes completed.

An exception that is raised again (as in the above cases (a), (b), (c)) is
said to be propogated, either by the execution of the subprogram, the 
execution of the block statement, or the elaboration of the package body.
No propogation takes place in the case of a task body.  If the frame is 
a subprogram or a block statement and if it has dependent tasks, the 
propogation of an exception takes place only after termination of the
dependent tasks.  

Finally, if an exception is raised in the sequence of statements of an
exception handler, execution of this sequence of statements is abandoned.
Subsequent actions (including propogation, if any) are as in the cases
(a) to (d), above."


So, here's an interesting design problem:  How does a task report
failure due to an exception to its parent?

			Dave Emery
			Siemens Research
UUCP:	   ...princeton!siemens!emery
ARPA:	      princeton!siemens!emery@topaz.rutgers.edu

  reply	other threads:[~1986-06-04 14:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-06-02 16:16 Propagation of exceptions raised within tasks frigo
1986-06-04 14:13 ` emery [this message]
1986-06-06 13:41   ` Propagation of exceptions raised wit Doug Bryan
1986-06-06 20:57 ` emery
1986-06-20 15:05 ` Propagation of exceptions raised wi stt
  -- strict thread matches above, loose matches on Subject: below --
1986-06-09 14:06 Propagation of exceptions raised wit Brosgol
replies disabled

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