comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Elaboration Order
Date: 1999/11/22
Date: 1999-11-22T00:00:00+00:00	[thread overview]
Message-ID: <81c1jv$b2a$1@nnrp1.deja.com> (raw)
In-Reply-To: x7vn1s9ouiu.fsf@pogner.demon.co.uk

In article <x7vn1s9ouiu.fsf@pogner.demon.co.uk>,
  Simon Wright <simon@pogner.demon.co.uk> wrote:
> And your compiler (well, binder) may not be able to tell
> whether there is an elaboration problem or not; _you_ may know
> that the task only makes a problematic call after it has been
> allowed to start via some rendezvous, which won't happen until
> the whole program has elaborated, but the _compiler_ may not.
>
> The cases where I've had this problem have both felt a bit
> unsatisfactory when I reviewed the design.

In GNAT, we have recently added the Restrictions pragma

  pragma Restrictions (No_Entry_Calls_In_Elaboration_Code);

This is checked statically by the compiler. It corresponds to
pretty much the normal situation in most programs. It is not
uncommon to have tasks start at elaboration time which
immediately hang on an accept. It is much less usual to start
these tasks off for real during elaboration by making entry
calls.

In the presence of this restrictions pragma (which could almost
be the default, we discussed making it the default in fact, but
decided against it), the compiler knows that such task bodies
do not get beyond the first accept, and thus we can ignore
elaboration issues from calls in subsequent code.

A bit kludgy, but then the whole idea of starting tasks at
elaboration time, which are free to do anything before the
rest of the program is fully elaborated is a nasty one, and
this kind of thing is not easily consistent with static
elaboration.

That being said, if you follow the general design principles
of:

  1. Never start stand alone tasks in elaboration code

  2. Always define separate task types

  3. Put the instances of tasks in separate units from the task
     types.

You can most often get a reliable static elaboration order
without needing this restrictions pragma. The above principles
seem good ones to me in any case, and probably relate to the
"felt a bit unsatisfactory" in above above quote



Sent via Deja.com http://www.deja.com/
Before you buy.




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

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-15  0:00 Elaboration Order Wolf-Dieter Heker
1999-11-15  0:00 ` Jean-Pierre Rosen
1999-11-15  0:00   ` Robert Dewar
1999-11-16  0:00     ` Jean-Pierre Rosen
1999-11-20  0:00       ` Simon Wright
1999-11-15  0:00 ` Robert Dewar
1999-11-16  0:00   ` Wolf-Dieter Heker
1999-11-16  0:00     ` Robert Dewar
1999-11-16  0:00     ` Robert Dewar
1999-11-20  0:00       ` Simon Wright
1999-11-22  0:00         ` Robert Dewar [this message]
1999-11-23  0:00           ` Mats Weber
1999-11-16  0:00     ` David C. Hoos, Sr.
     [not found] <314701A1.469D@lfwc.lockheed.com>
1996-03-15  0:00 ` Elaboration order Robert I. Eachus
1996-03-15  0:00   ` Robert Dewar
     [not found] ` <1996Mar14.021345.9856@enterprise.rdd.lmsc.lockheed.com>
     [not found]   ` <314829CD.4FA9@lfwc.lockheed.com>
1996-03-15  0:00     ` Tucker Taft
1996-03-15  0:00       ` Ken Garlington
1996-03-16  0:00     ` Joe Wierzbowski
1996-03-26  0:00       ` AdaWorks
1996-03-26  0:00         ` Robert Dewar
1996-03-26  0:00           ` Robert A Duff
1996-03-26  0:00             ` Robert Dewar
1996-03-26  0:00         ` Robert A Duff
1996-03-16  0:00     ` Ted Dennison
1996-03-26  0:00     ` Laurent Guerby
1996-03-26  0:00       ` Robert A Duff
1996-03-18  0:00 ` Ted Dennison
1996-03-18  0:00 ` Ken Garlington
1996-03-19  0:00 ` Michel Gauthier
1996-03-20  0:00 ` DenReimer
1996-03-20  0:00   ` Robert A Duff
1996-03-20  0:00     ` Norman H. Cohen
1996-03-20  0:00       ` Robert Dewar
1996-03-20  0:00   ` Norman H. Cohen
1996-03-20  0:00   ` Tucker Taft
     [not found] ` <Do8JDv.A2v@world.std.com>
     [not found]   ` <31494143.3825@lfwc.lockheed.com>
1996-03-15  0:00     ` Mark A Biggar
1996-03-18  0:00       ` Ken Garlington
1996-03-19  0:00         ` Chris McKnight
1996-03-21  0:00           ` Ken Garlington
1996-03-19  0:00         ` Norman H. Cohen
1996-03-20  0:00           ` Cordes MJ
1996-03-19  0:00             ` Robert Dewar
1996-03-21  0:00               ` Ken Garlington
1996-03-21  0:00               ` Cordes MJ
1996-03-20  0:00             ` Robert A Duff
1996-03-20  0:00               ` Cordes MJ
1996-03-20  0:00                 ` Robert Dewar
1996-03-21  0:00                   ` Ken Garlington
1996-03-20  0:00                 ` Robert A Duff
1996-03-22  0:00                   ` Cordes MJ
1996-03-23  0:00                 ` JP Thornley
1996-03-25  0:00                   ` Robert Dewar
1996-03-26  0:00                 ` JP Thornley
1996-03-15  0:00     ` Robert A Duff
1996-03-18  0:00       ` Norman H. Cohen
     [not found]       ` <EACHUS.96Mar18143219@spectre.mitre.org>
1996-03-18  0:00         ` Robert Dewar
1996-03-18  0:00         ` Robert Dewar
1996-03-19  0:00           ` Ted Dennison
1996-03-20  0:00         ` David Emery
1996-03-20  0:00   ` Robert I. Eachus
1996-03-22  0:00   ` Robert I. Eachus
1996-03-22  0:00   ` Robert I. Eachus
     [not found] <DoDMLL.1F9@world.std.com>
1996-03-18  0:00 ` Chris McKnight
  -- strict thread matches above, loose matches on Subject: below --
1996-03-18  0:00 Jean-Pierre Rosen
1996-03-21  0:00 ` Ken Garlington
replies disabled

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