comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Need a Sanity Check
Date: Fri, 20 May 2005 23:51:10 -0500
Date: 2005-05-20T23:51:10-05:00	[thread overview]
Message-ID: <q_edndNKWK44IBPfRVn-iQ@megapath.net> (raw)
In-Reply-To: 1116619695.361267.218380@g49g2000cwa.googlegroups.com

"mark" <ati@san.rr.com> wrote in message
news:1116619695.361267.218380@g49g2000cwa.googlegroups.com...
> "(but an accept statement cannot be called from within a protected
> subprogram or entry)."
>
> Is that a language restriction?  Compiling using GNAT I get -
>
>      warning: potentially blocking operation in protected operation
>
> when calling another tasks entry point from within a protected entry.
> I'm sure its not going to block based on the task it is calling has a
> single accept and is only called from this protected entry.   The task
> called does nothing special besides dump a buffer to disk.  Doing it
> this way just decouples the disk write from the rest of the system.
>
> So, is GNAT not enforcing language standards or is that really not part
> of the standard?

It's a bounded error, meaning that it either raises Program_Error or goes
forward (which might cause deadlock). In any case, it is not checked at
compile-time (because you could call anything from a protected object). And
even if it works on a specific compiler, it's not portable; another compiler
might raise Program_Error. Note that Ada 2006 adds a pragma Detect_Blocking,
which changes this to a requirement to raise Program_Error. (That's part of
Ravenscar, but I generally recommend it to everyone, because it makes the
behavior predictable.)

                           Randy.






      reply	other threads:[~2005-05-21  4:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-11  0:49 Need a Sanity Check autstspe
2005-05-11  3:19 ` Jeffrey Carter
2005-05-11 17:08   ` autstspe
2005-05-16 13:43 ` Steve
2005-05-16 15:18   ` Jean-Pierre Rosen
2005-05-20 20:08     ` mark
2005-05-21  4:51       ` Randy Brukardt [this message]
replies disabled

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