comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Advantages
Date: Mon, 28 Jun 2004 19:24:24 -0500
Date: 2004-06-28T19:24:24-05:00	[thread overview]
Message-ID: <C_edndCYIos9K33dRVn-vA@megapath.net> (raw)
In-Reply-To: sa47jtse93b.fsf@snoopy.apana.org.au

"Brian May" <bam@snoopy.apana.org.au> wrote in message
news:sa47jtse93b.fsf@snoopy.apana.org.au...
...
> The implication of what you say is you can't have a deadlock in Ada
> across different packages, that will compile, if you use protected
> objects in this manner to access variables
>
> Not true!

<Long example omitted>

All your example proves is that GNAT doesn't catch the error in this
program. It is a bounded error to use a blocking operation in protected
action (see 9.5.1(8-17)). It's defined to either be detected (and raise
Program_Error) or otherwise "may result in deadlock".

So, if you write code that's defined to deadlock, it isn't particularly
surprising that it deadlocks.

The reason that this is a bounded error is that it can't in general be
detected at compile-time, and there were those that thought the overhead of
detecting at run-time was too high. (Janus/Ada always detects it, so your
program would just raise Program_Error. But Janus/Ada wasn't designed for
hard real-time systems.) I'm pretty sure the intent was that it would be
detected if the cost wasn't too severe - there was no intent to allow such
things because of the havoc that could occur in the run-time.

Since GNAT detected the error at compile-time (thus the warning), there
couldn't be any run-time overhead for detecting the error. It should
therefore have raised Program_Error (allowing a known deadlock condition
seems like a very bad thing). But perhaps there is some customer of ACT's
that likes living dangerously? Or, perhaps the case just never came up,
because people rarely try to do the obviously bad...

                                   Randy.





  reply	other threads:[~2004-06-29  0:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27  7:04 Advantages Andrew Carroll
2004-06-27 15:16 ` Advantages Nick Roberts
2004-06-27 21:22   ` Advantages Pascal Obry
2004-06-28  0:51   ` Advantages Robert I. Eachus
2004-06-28  1:59     ` Advantages Brian May
2004-06-29  0:24       ` Randy Brukardt [this message]
2004-06-29  3:32         ` Advantages Hyman Rosen
2004-06-29 18:41           ` Advantages Randy Brukardt
2004-07-02  0:49             ` Advantages Brian May
2004-07-02  1:31               ` Advantages Jeffrey Carter
2004-07-02  9:13               ` Advantages Dmitry A. Kazakov
2004-07-02 12:27               ` Advantages Marin David Condic
2004-07-04 17:42       ` Advantages Robert I. Eachus
2004-06-28 12:08   ` Advantages Marin David Condic
2004-06-27 18:32 ` Advantages Jim Rogers
  -- strict thread matches above, loose matches on Subject: below --
2004-06-28  9:52 Advantages Lionel.DRAGHI
     [not found] <20040628005515.0A1E74C4160@lovelace.ada-france.org>
2004-06-28  6:23 ` Advantages Andrew Carroll
2004-06-28 14:44   ` Advantages Jacob Sparre Andersen
2004-07-04 18:11   ` Advantages Robert I. Eachus
2004-06-26  6:28 Advantages Andrew Carroll
2004-06-25 19:41 Advantages Andrew Carroll
     [not found] <20040624170516.B4DFC4C4110@lovelace.ada-france.org>
2004-06-25 12:24 ` Advantages Andrew Carroll
2004-06-25 12:22   ` Advantages Peter Amey
2004-06-26 20:43   ` Advantages Marin David Condic
replies disabled

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