Robinson, Matthew wrote:
>  I use this code, Not all my own, some from the php manual (probably
> most of it in fact) I lock the file as filename.lock so that I can muck
> about with it completely and then unlock the .lock and remove it.
>
> M
>
> function LockFile($file)
> {
>
>         $LockFile = $file . ".lock";                    # Lock the file
>         $lf = fopen ($LockFile, "wx");
>
>         while ($lf === FALSE && $i++ < 20)
>         {
>                 clearstatcache();
>                 usleep(rand(5,85));
>                 $lf = @fopen ($LockFile, 'x');


How come you use "wx" up there, and just 'x' here?

Is there some reason for that?

One may (or may not) want to consider a mechanism for throwing out really
old lock files, since it's possible your PHP script or application would
eventually fail to remove a lock file...  Or not, depending on how you
code the rest of it.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to