comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Potentially_Blocking aspect
Date: Thu, 28 Apr 2016 15:07:40 -0700
Date: 2016-04-28T15:07:40-07:00	[thread overview]
Message-ID: <nfu1ev$2f9$1@dont-email.me> (raw)
In-Reply-To: <84d1b14e-7d8d-4bf4-820b-1fc93ed76114@googlegroups.com>

On 04/28/2016 08:53 AM, mockturtle wrote:
>
> 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").

This restriction was a mistake. Protected objects exist to provide mutual 
exclusion without a thread of control. There are plenty of cases where mutual 
exclusion is needed, a thread of control is not, and blocking operations must be 
called. Requiring the use of a task in such cases is unreasonable, but is what 
we have.

Some compilers allow potentially blocking operations in protected operations by 
default, not raising Program_Error even when such an operation is detected, 
unless the user explicitly specifies otherwise. Clearly, people frequently want 
to put such operations into protected operations.

-- 
Jeff Carter
"[T]he Musgroves had had the ill fortune
of a very troublesome, hopeless son, and
the good fortune to lose him before he
reached his twentieth year ..."
Persuasion
154


  parent reply	other threads:[~2016-04-28 22:07 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
2016-04-28 22:07 ` Jeffrey R. Carter [this message]
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