note 18428 deleted from function.flock by danbrown

From: Date: Mon, 18 May 2009 00:50:26 +0000
Subject: note 18428 deleted from function.flock by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155440@lists.php.net to get a copy of this message
Note Submitter: sbsaylors at yahoo dot com ---- 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... :)

« previous php.notes (#155440) next »