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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Exclusive file access Date: Fri, 28 Aug 2015 22:06:23 +0100 Organization: A noiseless patient Spider Message-ID: References: <75714e3f-c047-413d-9aa5-3ff423167863@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="0903b4fccd19524a858dd481bbd547d7"; logging-data="29693"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TtjL83Lr+YdibzJ+BGS+TbHCaKIrEQIs=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:G+f/p2243X3qENbFUf8rc3OY2ck= sha1:BklzZivol7rUOG1dn5Yn631H5cc= Xref: news.eternal-september.org comp.lang.ada:27632 Date: 2015-08-28T22:06:23+01:00 List-Id: Anh Vo writes: > I would suggest to wrap it in a protected object. It checks for task > id of a process opening and reading must be the same. Otherwise, the > unidentified task will be blocked from accessing the file. That won't help, because the OP wants to protect the file from being opened by another *process*, not another task, and POs are for managing access in-process. As another data point, on OS X it seems that only the output from the last process to close the file actually appears. Perhaps GNAT.Lock_Files might help?