note 93657 deleted from function.flock by danbrown
| From: | danbrown@php.net | Date: | Tue, 22 Sep 2009 14:42:56 +0000 |
| Subject: | note 93657 deleted from function.flock by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160936@lists.php.net to get a copy of this message | ||
Note Submitter: user at host dot com
----
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 !