Hi all,
I have a question about the way flock() and fclose() work in PHP.
Consider the following code, slightly modified from the flock() PHP
manual page:
$fp = fopen(/tmp/lock.txt, w+);
if (flock($fp, LOCK_EX)) { // do an exclusive lock
fwrite($fp, $processName\n);
flock($fp, LOCK_UN);
Andrew Hill wrote:
$fp = fopen(/tmp/lock.txt, w+);
if (flock($fp, LOCK_EX)) { // do an exclusive lock
fwrite($fp, $processName\n);
flock($fp, LOCK_UN); // release the lock
} else {
echo Couldn't lock the file !;
}
fclose($fp);
[...]
In this case, although process B is the second
2 matches
Mail list logo