note 45897 deleted from function.flock by danbrown

From: Date: Mon, 18 May 2009 00:44:38 +0000
Subject: note 45897 deleted from function.flock by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155422@lists.php.net to get a copy of this message
Note Submitter: chuck ---- Creating lock files and testing for their existence is absolutely wrong, NFS or not. The only file operations that are guaranteed to be atomic are mkdir() and symlink(). And those aren't atomic over NFS (or other network filesystems) either. Short answer: create lock directories, not files. Don't stat the directory to test, simply try to create it and see if it fails. And all locking bets are always off with NFS.

« previous php.notes (#155422) next »