comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Contracts for protected objects: internal call cannot appear in precondition of protected operation
Date: Thu, 28 May 2020 21:11:45 -0500
Date: 2020-05-28T21:11:45-05:00	[thread overview]
Message-ID: <rapr13$673$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 4ed8fa1e-0b4d-4d6b-bc36-0236f6965db0@googlegroups.com

That's not allowed, as it would require extra mutual exclusion. Since that 
exclusion would have to be separate from the protected action (necessary 
since the entry may not be open when the call is made), you'd also have a 
race condition (the precondition could be evaluated with one value, the 
value then changed, and then later the entry accepted). Best practices is 
always that preconditions should only depend on the parameters to a call 
(regardless of the kind of call involved).

                        Randy.


"reinert" <reinkor@gmail.com> wrote in message 
news:4ed8fa1e-0b4d-4d6b-bc36-0236f6965db0@googlegroups.com...
> Hello,
>
> I tried to use pre-conditions for an entry in a protected object.
> Say (in the specification):
>
>   entry E1 with Pre => test1;
>
> This seems OK when test1 is external (defined outside the protected 
> object).
>
> However, when test1 is defined inside the protected object, I get:
>
> internal call cannot appear in precondition of protected operation
>
> (I assume this is related to avoid deadlock - but testing from outside
> here should not give deadlock?)
>
> I also would like to include (for security) a test on a variable
> defined in the private part of the protected object). Anyhow possible?
> I do not mange to include pre/post conditions in the body of my
> protected object. I missed something?
>
> reinert 


  reply	other threads:[~2020-05-29  2:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24  5:27 Contracts for protected objects: internal call cannot appear in precondition of protected operation reinert
2020-05-29  2:11 ` Randy Brukardt [this message]
2020-05-31 10:48   ` reinert
replies disabled

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