From: Robert A Duff on
"Jeffrey R. Carter" <spam.jrcarter.not(a)spam.acm.org> writes:

> An entry call is always potentially blocking, regardless of its barrier;
> see ARM 9.5.1. Technically, this code contains a bounded error. Since
> the potentially blocking operation was detected, your program should
> raise Program_Error; GNAT pretends that it hasn't detected that the
> operation is potentially blocking and lets you get away with only a
> warning. Other compilers (and even other versions of GNAT) may actually
> raise Program_Error.

Pragma Detect_Blocking will cause GNAT to raise Program_Error.
If you want to write portable code, you should use this
pragma.

- Bob
From: Jeffrey R. Carter on
Robert A Duff wrote:
>
> Pragma Detect_Blocking will cause GNAT to raise Program_Error.
> If you want to write portable code, you should use this
> pragma.

I thought there would be a way to make GNAT be an Ada compiler, but a quick look
at the secret documentation didn't find it.

--
Jeff Carter
"Strange women lying in ponds distributing swords
is no basis for a system of government."
Monty Python & the Holy Grail
66
From: Reto Buerki on
Jeffrey R. Carter wrote:
> Reto Buerki wrote:
>>
>> Update: we just noticed that the warning actually *does* show up but we
>> missed it in the previous build.
>>
>> I also think the warning is irrelevant. It seems that the compiler is
>> not smart enough to figure out that the Signal() entry is always open.
>
> An entry call is always potentially blocking, regardless of its barrier;
> see ARM 9.5.1. Technically, this code contains a bounded error. Since
> the potentially blocking operation was detected, your program should
> raise Program_Error; GNAT pretends that it hasn't detected that the
> operation is potentially blocking and lets you get away with only a
> warning. Other compilers (and even other versions of GNAT) may actually
> raise Program_Error.

Thanks for the clarification and the pointer to the ARM. This basically
means that our workaround is not legal Ada code ...

From: Reto Buerki on
Dmitry A. Kazakov wrote:
> On Mon, 28 Sep 2009 11:38:18 -0700, Jeffrey R. Carter wrote:
>
>> An entry call is always potentially blocking, regardless of its barrier; see ARM
>> 9.5.1. Technically, this code contains a bounded error. Since the potentially
>> blocking operation was detected, your program should raise Program_Error; GNAT
>> pretends that it hasn't detected that the operation is potentially blocking and
>> lets you get away with only a warning. Other compilers (and even other versions
>> of GNAT) may actually raise Program_Error.
>
> A small addition to above. If you wanted to call to an entry from inside a
> protected procedure you have two options:
>
> 1. the callee is made a protected procedure (can be factored out);

This does not work in our case because of the compiler bug: barriers are
only re-evaluated if the callee is an entry.

> 2. the caller is made an entry, and the call replaced with requeue.

We will look into this. Since access types to protected entries are not
allowed, we need to rewrite some alarm timer code first.
From: John B. Matthews on
In article <h9sgj7$1qr$1(a)news.eternal-september.org>,
Reto Buerki <reet(a)codelabs.ch> wrote:

> Jeffrey R. Carter wrote:
> > Reto Buerki wrote:
> >>
> >> Update: we just noticed that the warning actually *does* show up but we
> >> missed it in the previous build.
> >>
> >> I also think the warning is irrelevant. It seems that the compiler is
> >> not smart enough to figure out that the Signal() entry is always open.
> >
> > An entry call is always potentially blocking, regardless of its barrier;
> > see ARM 9.5.1. Technically, this code contains a bounded error. Since
> > the potentially blocking operation was detected, your program should
> > raise Program_Error; GNAT pretends that it hasn't detected that the
> > operation is potentially blocking and lets you get away with only a
> > warning. Other compilers (and even other versions of GNAT) may actually
> > raise Program_Error.
>
> Thanks for the clarification and the pointer to the ARM. This basically
> means that our workaround is not legal Ada code ...

Well, it's a bounded error. Using Pragma Detect_Blocking, as suggested
by Bob Duff, will tell you if the compiler's warning is actualized at
run-time. As this is a work-around and your original code seems correct,
you might arrange things so that the original can be restored easily
upon upgrade or port.

Because this can be a maintenance headache, you might also look through
some other examples of Timing_Events with a view towards your intended
usage:

<http://www.adaic.com/standards/05rat/html/Rat-1-3-4.html>
<http://www.adaic.com/standards/05rat/html/Rat-5-6.html>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>