- Flock manual clarification please ;-)

From: Date: Sat, 06 Apr 2002 15:47:09 +0000
Subject: - Flock manual clarification please ;-)
Groups: php.general 
Request: Send a blank email to php-general+get-91868@lists.php.net to get a copy of this message
From the manual: <snip> Note: Because flock() requires a file pointer, you may have to use a special lock file to protect access to a file that you intend to truncate by opening it in write mode (with a "w" or "w+" argument to fopen()). </snip> The manual indicates that you "may" need to use "a special lock file" if you intend to open a file with "w" or "w+". I wrote some code to examine this. (2 files) Each file locks a file after opening using "w" to do so. Then, the file is locked using LOCK_EX. Subsequently executed, each file appears to respect the lock applied by the other file. (Each file waits for the lock to be released by the other) - So, I don't see this manual entry applying in this case. In regards to the <snip> above, under what circumstances might you have to create a separate lock file? Is this an OS issue? Is it an issue when concurrency is high? The manual says "you may have to"; I am looking for some clarification as to when exactly you "may have to" follow the <snip> advice. Thanks as always, Matt Friedman Web Applications Developer www.SpryNewMedia.com

« previous php.general (#91868) next »