comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Tasking, protected objects, Ada 95 RM
Date: Tue, 18 Jul 2006 16:12:37 -0500
Date: 2006-07-18T16:12:37-05:00	[thread overview]
Message-ID: <p9udnS2ibIIE0yDZnZ2dnUVZ_qednZ2d@megapath.net> (raw)
In-Reply-To: 1153235397.700369.134780@35g2000cwc.googlegroups.com

"ldb" <ldb_nospam@hotmail.com> wrote in message
news:1153235397.700369.134780@35g2000cwc.googlegroups.com...
...
> It goes on to define potentially blocking actions as, of course, an
> entry_call. Now, I've never had my code raise a bounded error or a
> program error. Here is a quick synopsis of my questions:
>
> 1) Am I misunderstanding this particular part of the manual, and it, in
> fact, doesn't apply to my code?

Mostly likely. You've misunderstood the meaning of "protected action".
Loosely, that's the time when your program is executing *inside* of a
protected object (executing the code of a protected object). Your
description suggests you are not making an entry call from inside of a
protected object.

> 2) Should I be worried?

No.

> 3) Will -gnatp prevent this exception from being raised?

A "bounded error" is not necessarily an exception. It's actually better in
this case if it *is* an exception, because it indicates a fundamental design
flaw in your program. There is (in Ada 2005) a pragma Detect_Blocking for
this purpose. I think the vast majority of (portable) Ada programs should
include this pragma (the check is not expensive, and the results if the
error occurs are very dangerous and likely to be fatal).

You really, really, really do not want this error to go undetected. If an
exception is raised, you can find the cause and fix it (and even recover
from it in a limited way). If the error is *not* detected, the most likely
result is that your program will deadlock (the protected object will be
locked and no other task can get into it). Another possible result is the
loss of mutual exclusion for the protected object (which means it is highly
likely that the code of the PO will fail because of assumption failure).
Both of the latter are far harder to debug than getting an exception from
the bad operation!! Do not fear detection of errors!

                        Randy.





  parent reply	other threads:[~2006-07-18 21:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-18 15:09 Tasking, protected objects, Ada 95 RM ldb
2006-07-18 15:22 ` Ed Falis
2006-07-18 15:30   ` Ed Falis
2006-07-18 19:15 ` Georg Bauhaus
2006-07-18 21:12 ` Randy Brukardt [this message]
2006-07-19 14:00   ` ldb
  -- strict thread matches above, loose matches on Subject: below --
2006-07-18 16:38 Anh Vo
replies disabled

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