Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1254 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72300 invoked by uid 1007); 5 May 2003 11:02:13 -0000 Message-ID: <20030505110212.72298.qmail@pb1.pair.com> To: internals@lists.php.net Date: Mon, 05 May 2003 21:02:49 +1000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 References: <1051831866.2944.10.camel@hemna.uh.nu> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 203.37.117.98 Subject: Re: [PHP-DEV] xmldoc() takes ages >>> thread safety. From: tk.lists@fastmail.fm (Terence) Mark J. Hershenson wrote: > > Given the size, it seems better to use domxml_open_file() and bypass > pulling that all of that data into memory? > 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. Any insight would be appreciated. PS. This discussion (more so) also applies to DomDocument->dump_file()