summaryrefslogtreecommitdiff
path: root/gcc/ada/s-shasto.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-22 12:41:03 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-22 12:41:03 +0000
commit9cd35dc303e447b70bef00791ab51faf7f58e122 (patch)
treee71ada1b44accd69b5c3d3428de50631cc698cbb /gcc/ada/s-shasto.ads
parent47b749236902b9d409e4714456187bffaf3a001c (diff)
downloadgcc-9cd35dc303e447b70bef00791ab51faf7f58e122.tar.gz
2008-08-22 Kevin Pouget <pouget@adacore.com>
* s-shasto.ads, s-shasto.adb: Move Shared_Var_ROpen, Shared_Var_WOpen and Shared_Var_Close procedure specifications from package spec to package body. * rtsfind.ads: Remove RE_Shared_Var_Close, RE_Shared_Var_ROpen, RE_Shared_Var_WOpen entries. * exp_dist.adb: Update RE_Any_Content_Ptr to RE_Any_Container_Ptr in Build_To_Any_Call, Build_TypeCode_Call and Build_From_Any_Call procedures. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139445 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-shasto.ads')
-rw-r--r--gcc/ada/s-shasto.ads60
1 files changed, 11 insertions, 49 deletions
diff --git a/gcc/ada/s-shasto.ads b/gcc/ada/s-shasto.ads
index 2fd0341b7b6..40089a33075 100644
--- a/gcc/ada/s-shasto.ads
+++ b/gcc/ada/s-shasto.ads
@@ -82,30 +82,16 @@
-- For each shared variable, var, an instantiation of the below generic
-- package is created which provides Read and Write supporting procedures.
--- The routine Shared_Var_ROpen in package System.Shared_Storage
--- either returns null if the storage does not exist, or otherwise a
--- Stream_Access value that references the corresponding shared
--- storage, ready to read the current value.
-
--- The routine Shared_Var_WOpen in package System.Shared_Storage
--- returns a Stream_Access value that references the corresponding
--- shared storage, ready to write the new value.
-
--- Note that there is no general synchronization for these storage
--- read and write operations, since it is assumed that a correctly
--- operating programs will provide appropriate synchronization. In
--- particular, variables can be protected using protected types with
--- no entries.
-
--- The routine Shared_Var_Close is called to indicate the end of a
--- read/write operations. This can be useful even in the context of
--- the GNAT implementation. For instance, when a read operation and a
--- write operation occur at the same time on the same partition, as
--- the same stream is used simultaneously, both operations can
--- terminate abruptly by raising exception Mode_Error because the
--- stream has been opened in read mode and then in write mode and at
--- least used by the read operation. To avoid this unexpected
--- behaviour, we introduce a synchronization at the partition level.
+-- The routine Read in package System.Shared_Storage.Shared_Var_Procs
+-- ensures to assign variable V to the last written value among processes
+-- referencing it. A call to this procedure is generated by the expander
+-- before each read access to the shared variable.
+
+-- The routine Write in package System.Shared_Storage.Shared_Var_Proc
+-- set a new value to the shared variable and, according to the used
+-- implementation, propagate this value among processes referencing it.
+-- A call to this procedure is generated by the expander after each
+-- assignement of the shared varible.
-- Note: a special circuit allows the use of stream attributes Read and
-- Write for limited types (using the corresponding attribute for the
@@ -150,32 +136,8 @@
-- These calls to the read and assign routines, as well as the lock
-- and unlock routines, are inserted by the expander (see exp_smem.adb).
-with Ada.Streams.Stream_IO;
-
package System.Shared_Storage is
- package SIO renames Ada.Streams.Stream_IO;
-
- function Shared_Var_ROpen (Var : String) return SIO.Stream_Access;
- -- As described above, this routine returns null if the
- -- corresponding shared storage does not exist, and otherwise, if
- -- the storage does exist, a Stream_Access value that references
- -- the shared storage, ready to read the current value.
-
- function Shared_Var_WOpen (Var : String) return SIO.Stream_Access;
- -- As described above, this routine returns a Stream_Access value
- -- that references the shared storage, ready to write the new
- -- value. The storage is created by this call if it does not
- -- already exist.
-
- procedure Shared_Var_Close (Var : SIO.Stream_Access);
- -- This routine signals the end of a read/assign operation. It can
- -- be useful to embrace a read/write operation between a call to
- -- open and a call to close which protect the whole operation.
- -- Otherwise, two simultaneous operations can result in the
- -- raising of exception Data_Error by setting the access mode of
- -- the variable in an incorrect mode.
-
procedure Shared_Var_Lock (Var : String);
-- This procedure claims the shared storage lock. It is used for
-- protected types in shared passive packages. A call to this
@@ -185,7 +147,7 @@ package System.Shared_Storage is
procedure Shared_Var_Unlock (Var : String);
-- This procedure releases the shared storage lock obtained by a
- -- prior call to the Shared_Mem_Lock procedure, and is to be
+ -- prior call to the Shared_Var_Lock procedure, and is to be
-- generated as the last operation in the body of a protected
-- subprogram.