note 44694 added to function.flock
| From: | jeppe at bundsgaard dot net | Date: | Fri, 13 Aug 2004 03:50:06 +0000 |
| Subject: | note 44694 added to function.flock | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74575@lists.php.net to get a copy of this message | ||
To jeroenl and lockwang.
You're right lockwang - but I think it can be solved by adding a check of the file modification
time - and deleting old lock's - say 10 seconds old - and then just hope that whatever caused
the lockfile not to be deleted didn't influence the file you want to write to. So I would add
these lines to jeroenl's script (after $lock=...):
$filemtime=filemtime($lock);
if ($filemtime and time()-$filemtime>10000)
unlink($lock);
----
Manual Page -- http://www.php.net/manual/en/function.flock.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44694
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44694&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44694&report=yes
Search -- http://master.php.net/manage/user-notes.php