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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,17f674692867d416,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!v25g2000yqk.googlegroups.com!not-for-mail From: vlc Newsgroups: comp.lang.ada Subject: Atomic file creation Date: Mon, 4 Jan 2010 05:40:11 -0800 (PST) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 87.221.73.92 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1262612411 22812 127.0.0.1 (4 Jan 2010 13:40:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 4 Jan 2010 13:40:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v25g2000yqk.googlegroups.com; posting-host=87.221.73.92; posting-account=ROuOHgoAAABopjDuvPBd02HgYVR-VCZk User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/20091215 Ubuntu/9.10 (karmic) Firefox/3.5.6,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8588 Date: 2010-01-04T05:40:11-08:00 List-Id: Hi *, I am looking for a way to create a file without overwriting it. A simple approach would be: 1 if not Ada.Directories.Exists ("file") then 2 Ada.Text_IO.Create ("file"); 3 end if; But this is not completely safe as it is not atomic. A higher-priority task e.g. could intercept my task between lines 1 and 2 and create the same file. In this case the file would be overwritten. Is there something like C's O_EXCL flag for "open" in Ada? Thanks a lot in advance.