comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Opening a file vs. creating if not yet exists
Date: Thu, 21 Aug 2008 14:06:35 -0700 (PDT)
Date: 2008-08-21T14:06:35-07:00	[thread overview]
Message-ID: <919bcbea-3eac-41dd-b784-e1b2eff6e252@k37g2000hsf.googlegroups.com> (raw)
In-Reply-To: 48AD8CBE.5060801@users.sourceforge.net

On 21 Sie, 17:41, Martin Krischik <krisc...@users.sourceforge.net>
wrote:

> > The atomicity of the complete solution is not an issue, since there is
> > no chance for the log file to be deleted by some other entity.
>
> Realy no chance? Did you consider
>
> rm -rf *.log

Yes, and this is not an issue for the reason of hazards.
Since the action of removing files this way would be asynchronous with
regards to the logging program, we should really protect against
calling it in both cases: "just before" opening the file as well as
"just after". The latter is a problem - no amount of trickery in the
program (atomic or not) can protect this case and if that happens the
log file becomes invisible (except for the program which would keep
the only, but unnamed, link to the file) and the file would vanish at
the program exit. Not very useful.
That's why we have to either assume that this never happens - and then
the first case need no protection - or that it is hopeless anyway.
Nothing to do in either case.

(the above assumes POSIX, Windows may behave differently)

> Ok I am pulling your leg here.

Sure. That's what makes usenet more funny. :-)

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com

Database Access Library for Ada: www.inspirel.com/soci-ada



  reply	other threads:[~2008-08-21 21:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-18 15:03 Opening a file vs. creating if not yet exists Maciej Sobczak
2008-08-19 12:36 ` Rob Norris
2008-08-19 12:58 ` amado.alves
2008-08-19 14:23 ` Jacob Sparre Andersen
2008-08-19 14:58   ` Maciej Sobczak
2008-08-21 15:41     ` Martin Krischik
2008-08-21 21:06       ` Maciej Sobczak [this message]
2008-08-21 15:42     ` Martin Krischik
replies disabled

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