From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!alberta!arcsun.arc.ab.ca!jade!lomow From: lomow@jade.uucp (Greg Lomow) Newsgroups: comp.lang.ada Subject: Entries with Access Types as Formal Parameters Message-ID: <1990Dec21.155154.21208@jade.uucp> Date: 21 Dec 90 15:51:54 GMT Organization: Jade Simulations International, Inc. List-Id: 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; ------------------------------------------------------------ --