From: Mark H Johnson <Mark_H_Johnson@raytheon.com>
Subject: Re: Files opened for exclusive read
Date: Fri, 05 Mar 2004 13:32:42 -0600
Date: 2004-03-05T13:32:42-06:00 [thread overview]
Message-ID: <wB42c.6$QB4.5@dfw-service2.ext.ray.com> (raw)
In-Reply-To: <5b42c.5$QB4.4@dfw-service2.ext.ray.com>
Mark H Johnson wrote:
> Preben Randhol wrote:
>
>>
>> Will shared=yes be silently ignored on a linux/unix OS where this is not
>> an issue?
>>
> It has been a couple years since I asked that question of ACT, but I
> believe the answer is NO. When shared=yes, the GNAT run time will share
> the file pointer (buffers, etc.). This was NOT what we wanted - we
> happened to have more than one task reading some initialization data
> from a file and were expecting each task to read the whole file (not
> just pieces).
> --Mark
>
In retrospect, my explanation is perhaps a little too brief. The
following is a summary of a recent (5.02a) copy of the GNAT User's Guide
(section 8.8, Shared Files)
In the absence of a shared=xxx, attempting to open two or more files w/
the same full name is an error (raises USE_ERROR).
If shared=no, the file can be opened with separate stream identifiers w/
the exact effect dependent on how the C stream routines do this.
If shared=yes and two or more files are opened with the same full name,
the same stream is shared between the files w/ the semantics in section
A.14 of the Ada Reference Manual.
So, to recap - shared=yes is not ignored, the semantics in the ARM are
followed. If you want to open the same file more than once w/o error and
without sharing, use shared=no. [at least this is how it works on x86
Linux, I can't comment on other machine/OS combinations]
--Mark
next prev parent reply other threads:[~2004-03-05 19:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-05 13:13 Files opened for exclusive read Daniel Allex
2004-03-05 14:44 ` Preben Randhol
2004-03-05 16:54 ` Robert I. Eachus
2004-03-05 18:14 ` Preben Randhol
2004-03-05 19:04 ` Mark H Johnson
2004-03-05 19:32 ` Mark H Johnson [this message]
2004-03-05 19:52 ` Preben Randhol
2004-03-06 1:05 ` Jeffrey Carter
2004-03-08 3:47 ` Dan Allex
2004-03-16 5:28 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox