note 23186 added to function.flock
| From: | robi at piros dot zold dot net | Date: | Thu, 11 Jul 2002 10:44:31 +0000 |
| Subject: | note 23186 added to function.flock | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32896@lists.php.net to get a copy of this message | ||
As far as I know, it does not actually prevent anything, except for other flock calls succeeding on
the same inode which would try to set incompatible lock modes (write is incompatible both ways with
any other lock).
Remember it is an advisory lock. It just maintains an entry in the inode that the file is locked for
this-or-that mode with the flock function.
For every critical operation first you need to obtain the lock for yourself, which if succeeds,
means, that noone will be disturbed if you do something with the file.
For open or similar calls resulting in destruction of data, eg. truncating, deleting the file, a
separate lockfile should be used for carrying the lock and flock should be called on that file.
Robert Varga
--
http://www.php.net/manual/en/function.flock.php
http://master.php.net/manage/user-notes.php?action=edit+23186
http://master.php.net/manage/user-notes.php?action=delete+23186
http://master.php.net/manage/user-notes.php?action=reject+23186