Mail Archives: djgpp-workers/2001/08/18/03:37:47
> From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
> Date: Fri, 17 Aug 2001 23:53:28 -0500 (CDT)
>
> > > > I suggest the other way around: open first, then close the LFN
> > > > handle. This way, you minimize the risk of something removing the
> > > > file in between. (You might need to fsync the handle before the call
> > > > to _open, though.)
>
> At this point the file should be empty either way, so why would fsync
> be needed?
Without fsync, the file might not be empty on disk, or might not even
exist, if you created it. I'm not saying you _must_ use fsync, just
that you _might_ need it.
> I think the odds of the file disappearing in the millisecond
> between close and reopen to be pretty small (especially since this
> insanity only is foisted upon Win2K/XP).
Windows is a multi-processing system, so that millisecond could become
much longer, if the CPU is preempted between close and reopen.
_creat_new is used by functions which create temporary files, where
this contention might be important and should be kept to a minimum.
- Raw text -