Re: GNAT for MS Visual Studio



On 8 Pa , 09:50, "Dmitry A. Kazakov" <mail...@xxxxxxxxxxxxxxxxx>
wrote:

It is called "higher level language," which translates to "you cannot have
ideas even if you just do 'a read'". I.e. there is no difference.

There is - others already explained that containers do some
bookkeeping even when they are "just" read. This bookkeeping is hidden
from you.

What is a shared data outside the protected object?
If I have an access variable that is kept inside the protected object
- is the object (the target) considered to be inside the protected
object as well?

Certainly not.

Then certainly everything is FUBARed.

Consider a container inside the protected object. The container
presumably has access variables to actual contained objects (to
elements) - some containers just cannot be implemented any other way.
If the target objects are considered to be OUTside of the protected
object and thus unprotected, then I'm looking forward to see an
explanation how the synchronized manipulation of these contained
objects is supposed to work.

Maybe those patterns are just wrong? (:-)) If you use an access
discriminant or component in a protected object, then the target shall not
be accessible otherwise than through a protected action traversing this
object.

Yes. But is this guaranteed? AARM seems to say that objects outside of
the protected objects are not synchronized. Is the target object
covered or not?

Consider this:

protected P is
procedure Set (I : Integer);
function Get return Integer;
end P;

Value : Integer;
protected body P is
procedure Set (I : Integer) is
begin
Value := I;
end Set;

function Get return Integer is
begin
return Value;
end Get;
end P;

Assume that users only interact with the protected object (Value can
be in the package body, etc.).
Is it compliant? As far as I understand AARM (9.10/9.b), it is not.
Value is OUTside of the protected object.

If it's not, then just adding access value to Value will not make any
difference, unless access values have some implicit magic properties
in the area of memory consistency.

I don't see any problems with procedures and entries, functions are my
concern.

See above. Is it "kosher"? If yes, then 9.10/9.b is unclear to me. If
not, then there is no way to synchronize a container that is
implemented in terms of references (linked lists, etc.).

I am not sure what you mean here. You can safely access things outside
protected objects from protected actions.

Can you confront it with 9.10/9.b?

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com

.



Relevant Pages

  • Re: Multitasking and containers
    ... from concurrent tasks as long as the parameters do not overlap. ... protected "by using the normal techniques such as protected objects". ... But reading from the protected object is not mutually exclusive (many ... I think he didn't mean container being a protected object. ...
    (comp.lang.ada)
  • Re: Multitasking and containers
    ... John Barnes suggests that in order to read from the same container, the operations need to be protected "by using the normal techniques such as protected objects". ... But reading from the protected object is not mutually exclusive - so where's the gain? ... What's the difference between concurrent reads of, say, a Vector via protected object vs. direct access? ... That would be interesting, but would break apart when encapsulated within a protected object, because there multiple readers would be allowed. ...
    (comp.lang.ada)
  • Re: Multitasking and containers
    ... But reading from the protected object is not mutually exclusive (many ... between concurrent reads of, say, a Vector via protected object vs. ... I think he didn't mean container being a protected object. ... The cache shared between ...
    (comp.lang.ada)
  • Re: Multitasking and containers
    ... But I think that's true only when multiple readers are calling protected ... protected procedure when manipulating a container nested inside a protected ... Declare the container object inside a protected object, ... long as you use protected procedures, ...
    (comp.lang.ada)