Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1255 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80267 invoked from network); 5 May 2003 11:10:55 -0000 Received: from unknown (HELO jdi.jdimedia.nl) (212.204.192.51) by pb1.pair.com with SMTP; 5 May 2003 11:10:55 -0000 Received: from jdi.jdimedia.nl (jdi.jdimedia.nl [212.204.192.51]) by jdi.jdimedia.nl (8.12.4/8.12.4) with ESMTP id h45BArC6025022; Mon, 5 May 2003 13:10:53 +0200 Date: Mon, 5 May 2003 13:10:53 +0200 (CEST) X-X-Sender: derick@jdi.jdimedia.nl To: Terence cc: internals@lists.php.net In-Reply-To: <20030505110212.72298.qmail@pb1.pair.com> Message-ID: References: <1051831866.2944.10.camel@hemna.uh.nu> <20030505110212.72298.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: Thread safety (was: [PHP-DEV] xmldoc() takes ages) From: derick@php.net (Derick Rethans) 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/ -------------------------------------------------------------------------