flock() - how does this baby work?
[email protected] ("August Zajonc")
| Newsgroups | php.version4 |
|---|---|
| Message-ID | <000501bfc8c1$478d9e50$5c23ced1@aontic> |
Looking to lock a file. I acquire the lock twice here, and both times it's
exclusive. Am I missing something here? Does the second flock have to be on
a different file handle? Creating $fp2 pointing to the same file and then
trying to acquire an exclusive lock seemed to block, even with operation set
to 6.
<?
$fp = fopen("test", "w+");
if(flock($fp, 2))
echo "locked";
if(flock($fp, 2))
echo "locked";
?>
Output is two locked statements instead of the one I expected.
August