comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Propagation of unhandled exceptions during elaboration, in a tasking program
Date: 1999/11/01
Date: 1999-11-01T11:59:31+00:00	[thread overview]
Message-ID: <7vjvb3$kn5$1@hobbes2.crc.com> (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?










             reply	other threads:[~1999-11-01  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-01  0:00 David C. Hoos, Sr. [this message]
1999-11-01  0:00 ` Propagation of unhandled exceptions during elaboration, in a tasking program 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
replies disabled

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