note 78318 added to function.flock
| From: | AnttiHaapala at osu1 dot php dot net | Date: | Sat, 06 Oct 2007 10:41:36 +0000 |
| Subject: | note 78318 added to function.flock | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131177@lists.php.net to get a copy of this message | ||
The supplied documentation is vague, ambiguous and lacking, and the user comments contain erroneous
information! The flock function follows the semantics of the Unix system call bearing the same name.
Flock utilizes ADVISORY locking only; that is, other processes may ignore the lock completely; it
only affects those that call the flock call.
LOCK_SH means SHARED LOCK. Any number of processes MAY HAVE A SHARED LOCK simultaneously. It is
commonly called a reader lock.
LOCK_EX means EXCLUSIVE LOCK. Only a single process may possess an exclusive lock to a given file at
a time.
If the file has been LOCKED with LOCK_SH in another process, flock with LOCK_SH will SUCCEED. flock
with LOCK_EX will BLOCK UNTIL ALL READER LOCKS HAVE BEEN RELEASED.
If the file has been locked with LOCK_EX in another process, the CALL WILL BLOCK UNTIL ALL OTHER
LOCKS have been released.
If however, you call flock on a file on which you possess the lock, it will try to change it. So:
flock(LOCK_EX) followed by flock(LOCK_SH) will get you a SHARED lock, not "read-write"
lock.
----
Server IP: 80.81.171.181
Probable Submitter: 213.139.171.67
----
Manual Page -- http://www.php.net/manual/en/function.flock.php
Edit -- https://master.php.net/note/edit/78318
Del: integrated -- https://master.php.net/note/delete/78318/integrated
Del: useless -- https://master.php.net/note/delete/78318/useless
Del: bad code -- https://master.php.net/note/delete/78318/bad+code
Del: spam -- https://master.php.net/note/delete/78318/spam
Del: non-english -- https://master.php.net/note/delete/78318/non-english
Del: in docs -- https://master.php.net/note/delete/78318/in+docs
Del: other reasons-- https://master.php.net/note/delete/78318
Reject -- https://master.php.net/note/reject/78318
Search -- https://master.php.net/manage/user-notes.php