comp.lang.ada
 help / color / mirror / Atom feed
* Potentially_Blocking aspect
@ 2016-04-28 15:53 mockturtle
  2016-04-28 20:30 ` Randy Brukardt
  2016-04-28 22:07 ` Jeffrey R. Carter
  0 siblings, 2 replies; 4+ messages in thread
From: mockturtle @ 2016-04-28 15:53 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-29  7:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-28 15:53 Potentially_Blocking aspect mockturtle
2016-04-28 20:30 ` Randy Brukardt
2016-04-28 22:07 ` Jeffrey R. Carter
2016-04-29  7:31   ` Dmitry A. Kazakov

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