note 18428 added to function.flock

From: Date: Tue, 22 Jan 2002 19:39:49 +0000
Subject: note 18428 added to function.flock
Groups: php.notes 
Request: Send a blank email to php-notes+get-25697@lists.php.net to get a copy of this message
Well I needed some kind of "lock" in windows, so I just created a lock.file in that directory. So if anything wants to 'write' to that file (or append, whatever) it checks to see if a lock.file (or whatever name you want to use) is there and if the date of the file is old. If its old (1 hour) then it deletes it and goes ahead. If its not old then it waits a random time. When its finised it deletes the file. Seems to work alright but I havent tested anything and its only used for maybe a 100 hits a day but... :) -- http://www.php.net/manual/en/function.flock.php http://master.php.net/manage/user-notes.php?action=edit+18428 http://master.php.net/manage/user-notes.php?action=delete+18428 http://master.php.net/manage/user-notes.php?action=reject+18428

« previous php.notes (#25697) next »