comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Atomic file creation
Date: Mon, 04 Jan 2010 15:25:35 +0100
Date: 2010-01-04T15:25:35+01:00	[thread overview]
Message-ID: <4b41fa5f$0$7620$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <c06d32c4-e160-4a74-9f7a-efe3d7108cc8@v25g2000yqk.googlegroups.com>

vlc schrieb:

> 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.

A multitasking program can use a protected object
for this.  Have all tasks perform I/O if and only if
it is their turn as decided by the queuing control of
the protected object.

> Is there something like C's O_EXCL flag for "open" in Ada?

Strictly speaking, O_EXCL is not C, but it is provided by Unix's
open(2) call. fopen(3), which is C, does not offer exclusive access
IIRC.

The Form string parameter of your Ada implementation might
provide sharing control.  The docs will then explain how a
Form value affects files opened by many tasks; possibly even
explain whether the form strings have an effect on using the
external file in other programs.



  parent reply	other threads:[~2010-01-04 14:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-04 13:40 Atomic file creation vlc
2010-01-04 14:24 ` vlc
2010-01-04 15:52   ` Jean-Pierre Rosen
2010-01-04 16:45     ` vlc
2010-01-04 17:12       ` Jean-Pierre Rosen
2010-01-04 22:38         ` Ludovic Brenta
2010-01-04 23:00           ` Dmitry A. Kazakov
2010-01-05  9:15     ` Jacob Sparre Andersen
2010-01-05  4:16   ` Stephen Leake
2010-01-05 14:48     ` vlc
2010-01-09 15:23       ` Stephen Leake
2010-01-04 14:25 ` Georg Bauhaus [this message]
2010-01-04 14:45   ` vlc
2010-01-04 14:49 ` Jacob Sparre Andersen
2010-01-04 15:07   ` vlc
2010-01-04 17:14     ` Jacob Sparre Andersen
2010-01-05 14:43       ` vlc
2010-01-06  2:28     ` Brad Moore
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox