From: lomow@jade.uucp (Greg Lomow)
Subject: Entries with Access Types as Formal Parameters
Date: 21 Dec 90 15:51:54 GMT [thread overview]
Message-ID: <1990Dec21.155154.21208@jade.uucp> (raw)
I have a question about Ada but unfortunately I don't have access
to an Ada compiler. Please forgive errors in the code example
that follows.
Consider a task with an entry that has a formal parameter of mode
"in out" which is an access type. Now consider a call to that
entry by another task where the actual parameter is an access
value that denotes a variable within the calling task. During the
execution of the accept statement the called task reads and
writes the variable denoted by the parameter.
Is the program well-defined? Or is it erroneous? If the program
is well-defined, what occurs at run-time? What if the program is
running on a distributed system and the two tasks are running on
different processors that do not have access to shared memory? If
you can, please cite references to the Ada Reference Manual.
------------------------------------------------------------
type int_access is access integer;
task a is
entry e(ia : in out int_access);
end;
task b;
------------------------------------------------------------
task body a is
i : integer;
begin
accept e(ia : int_access) do
i := ia.all;
ia.all := 20;
end;
end;
task body b is
ia : int_access;
begin
ia := new integer(13);
a.e(ia);
end b;
------------------------------------------------------------
--
reply other threads:[~1990-12-21 15:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox