On Mon, 5 May 2003, Terence wrote:
> Not so long ago I posted to comp.lang.php to raise the discussion about
> thread safety of accessing files with domxml_open_file() (and also other
> extension specific file-accessing functions). No one replied but I
> wanted to know if it was safer to suck the data into memory while using
> flock() on the file so that there was no (less?) danger of getting dirty
> reads/writes if the file was being accessed from concurrently running
> scripts.
>
> Of course, using flock() means that you actually have to load the file
> into memory first which is obviously bad given your evidence (even when
> not using file() and putting it in a very large hash first).
>
> I'm wandering if it is neccesary to use flock() on ALL filesystem
> interactions in a web based (multi-threaded) application.
Yes, that's necessary, and not only in multithreaded applications, also
in multi-process applications like the Apache webserver. But those
questiosn really belong on the php-general@lists.php.net mailinglist.
Derick
--
"my other box is your windows PC"
-------------------------------------------------------------------------
Derick Rethans http://derickrethans.nl/
PHP Magazine - PHP Magazine for Professionals http://php-mag.net/
-------------------------------------------------------------------------