comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Potentially_Blocking aspect
Date: Thu, 28 Apr 2016 15:30:34 -0500
Date: 2016-04-28T15:30:34-05:00	[thread overview]
Message-ID: <nftrta$nc2$1@loke.gir.dk> (raw)
In-Reply-To: 84d1b14e-7d8d-4bf4-820b-1fc93ed76114@googlegroups.com

See AI12-0064-1 and AI12-0064-2. That, we're actively working on it. 
(Although the sense is backwards from your idea; but that's obviously 
necessary for compatibility.)

The problem is, neither of those proposals really works for compatiblity and 
usability purposes. (Requiring all existing generics, like the containers, 
to be potentially blocking, defeats the purpose in my mind - which kills 
alternative 1. And my alternative (2) doesn't work because in many real 
cases, the function or object can't be the prefix of an attribute as it 
doesn't have a unique name. "="'Nonblocking just doesn't work in Ada.)

This is obviously a hard problem. I don't know where we'll go from here, but 
I'm sure we'll be discussing these again in Pisa.

                                          Randy.

"mockturtle" <framefritti@gmail.com> wrote in message 
news:84d1b14e-7d8d-4bf4-820b-1fc93ed76114@googlegroups.com...
Hi.all,
a curiosity just came to my mind.

Inside a protected object it is forbidden to invoke a potentially blocking 
operation.  Although some cases are easily recognized, it could be that a 
procedure invokes (via several levels of indirection) a blocking action.  As 
I understand, you can specify pragma Detect_Blocking, but this works at 
runtime (since H.5 says "An implementation is required to detect a 
potentially blocking operation within a protected operation, and to raise 
Program_Error").

I was wondering about a possible Potentially_Blocking aspect.  Something 
like
(disclaimer: I am making it while I am writing...)

procedure foo(x: integer)
with Potentially_Blocking;

It would be a compile-time error if a procedure that does something blocking 
(an entry call, a select, ... or a call to another Potentially_Blocking 
procedure) does not have the Potentially_Blocking aspect.  Likewise, it 
would be an error to have the aspect when the procedure is not potentially 
blocking.
This would allow you to detect calls to blocking procedures at compile time.

Of course, in order to avoid back-compatibility problems, you could add a 
pragma like Mandatory_Potentially_Blocking(Flag : Boolean) that allows you 
to turn on and off the necessity declaring potentially blocking procedures.

I checked and it seems that no such aspect is currently defined.  There is 
some special reason for this?

Riccardo 


  reply	other threads:[~2016-04-28 20:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 15:53 Potentially_Blocking aspect mockturtle
2016-04-28 20:30 ` Randy Brukardt [this message]
2016-04-28 22:07 ` Jeffrey R. Carter
2016-04-29  7:31   ` Dmitry A. Kazakov
replies disabled

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