comp.lang.ada
 help / color / mirror / Atom feed
* Propagation of unhandled exceptions during elaboration, in a tasking program
@ 1999-11-01  0:00 David C. Hoos, Sr.
  1999-11-01  0:00 ` Robert Dewar
  1999-11-02  0:00 ` Nick Roberts
  0 siblings, 2 replies; 6+ messages in thread
From: David C. Hoos, Sr. @ 1999-11-01  0:00 UTC (permalink / raw)


Hi all,
I have a question about the expected behavior of an Ada
program when an unhandled exception is raised during
elaboration, and other tasks (at least threads) are running.

The context is this:

  I have a package called Configuration_Data that exports a
number of parameterless functions that return values used
in the declarations of various items -- e.g. the block_size
and block_count for storage pools, etc.  This package obtains
the values returned by these functions from a text file that
is opened and read during the elaboration of the package body.

An exception block surrounds the call to open the file, and
any exception is re-raised with added exception information:
e.g. "attempting to open file """ & Filename & """."

This scheme has worked well, giving the use an informative
error message if the configuration file cannot be opened.

However, in a tasking program, several threads have been
started by the time Configuration_Data is elaborated, and
the exception information is not written to the standard
output nor to the standard error file, if the file cannot
be opened.

I "worked around" the problem, by, instead of re-raising
the exception, writing the informative message to the
standard error file, and calling
POSIX.Process_Primitives.Exit_Process.  Now, the user
sees what's wrong, and knows what corrective action to take.



My question is this -- is the behavior I've described
what is expected from an Ada program?










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

end of thread, other threads:[~1999-11-02  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-01  0:00 Propagation of unhandled exceptions during elaboration, in a tasking program David C. Hoos, Sr.
1999-11-01  0:00 ` Robert Dewar
1999-11-02  0:00 ` Nick Roberts
1999-11-02  0:00   ` Robert Dewar
1999-11-02  0:00     ` Robert A Duff
1999-11-02  0:00       ` Robert Dewar

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