#36824 [Opn->Csd]: flock with LOCK_NB not working
| From: | mauroi at digbang dot com | Date: | Wed, 22 Mar 2006 21:57:06 +0000 |
| Subject: | #36824 [Opn->Csd]: flock with LOCK_NB not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94779@lists.php.net to get a copy of this message | ||
ID: 36824
User updated by: mauroi at digbang dot com
Reported By: mauroi at digbang dot com
-Status: Open
+Status: Closed
Bug Type: Filesystem function related
Operating System: Win XP SP2
PHP Version: 5.1.2
New Comment:
I'm sorry.
Seems that this happens only in Firefox (don't know why).
Even with a simple script:
<?
echo 'aa';
sleep(5);
echo 'bb';
?>
Previous Comments:
------------------------------------------------------------------------
[2006-03-22 22:10:43] mauroi at digbang dot com
NOTE: I've also added a session_write_close() at the beginning.
------------------------------------------------------------------------
[2006-03-22 21:51:29] mauroi at digbang dot com
Same problem.
Thanks.
------------------------------------------------------------------------
[2006-03-22 21:05:38] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
------------------------------------------------------------------------
[2006-03-22 20:53:21] mauroi at digbang dot com
Description:
------------
If I execute two consecutive times (in different browser tabs) the
following script, LOCK_NB doesn't work. I mean, the second tab waits
for the first to finish.
Thanks in advance.
Reproduce code:
---------------
<?
$handle = fopen('c:\foo', 'w+');
if ($handle)
{
if (flock($handle, LOCK_EX + LOCK_NB))
{
echo 'locked!';
sleep(5);
}
else
{
echo 'not locked!';
}
fclose($handle);
}
?>
Expected result:
----------------
1st:
locked!
2nd:
locked!
Actual result:
--------------
1st:
locked!
2nd:
not locked!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36824&edit=1