note 93657 added to function.flock
| From: | user at host dot com | Date: | Mon, 21 Sep 2009 21:58:34 +0000 |
| Subject: | note 93657 added to function.flock | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160905@lists.php.net to get a copy of this message | ||
Manual says that "
# LOCK_NB if you don't want flock() to block while locking. (not supported on Windows) " ,
but it's actually supported on windows! (at least in php 5.2.3), and behavior of
flock("file" , LOCK_EX) and flock("file" , LOCK_EX | LOCK_NB) is different!
In case of LOCK_EX, if file is locked flock() will wait (don't know for how long) until lock is
released and never return false, and if option is LOCK_EX | LOCK_NB then flock will return false
immediately if file is locked (and return true otherwise)
Took me about an hour to figure this out :)
Tested on windows2000, apache 2.2 , php 5.2.3 . I think manual should be updated !
----
Server IP: 78.41.111.4
Probable Submitter: 81.23.157.26
----
Manual Page -- http://www.php.net/manual/en/function.flock.php
Edit -- https://master.php.net/note/edit/93657
Del: integrated -- https://master.php.net/note/delete/93657/integrated
Del: useless -- https://master.php.net/note/delete/93657/useless
Del: bad code -- https://master.php.net/note/delete/93657/bad+code
Del: spam -- https://master.php.net/note/delete/93657/spam
Del: non-english -- https://master.php.net/note/delete/93657/non-english
Del: in docs -- https://master.php.net/note/delete/93657/in+docs
Del: other reasons-- https://master.php.net/note/delete/93657
Reject -- https://master.php.net/note/reject/93657
Search -- https://master.php.net/manage/user-notes.php