note 23186 deleted from function.flock by dams

From: Date: Sun, 28 Jul 2002 14:49:36 +0000
Subject: note 23186 deleted from function.flock by dams
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-33821@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

« previous php.notes (#33821) next »