On Fri, 2002-02-15 at 08:14, Erik Price wrote:
> On Friday, February 15, 2002, at 04:53  AM, Lars Torben Wilson wrote:
> > The problem with that is that you have a time lag (perhaps only
> > in microseconds, but it still is a problem) while you're writing
> > the new data to the file. If some other process--say, another
> > invocation of the same script--tries to read from that file while
> > you're still overwriting it--you've got problems, since it'll find
> > only a partially-written file.
> >
> > That's called a 'race condition'. The other method avoids that,
> > since while you're writing data to the temp file, processes just
> > keep using the original. Once you're done, the rename happens
> > atomically, preventing the race condition.
> What method do you use to get rid of the temporary file once you've used 
> it?  It appears, from reading the man page, that the file is still 
> present in the directory specified in tempname().
> Erik  <-- doesn't know much about working with files in PHP

unlink(), or you could use tmpfile() instead.

 Torben Wilson <[EMAIL PROTECTED]>

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to