svn: /phpdoc/en/trunk/reference/filesystem/functions/ flock.xml
| From: | Adam Harvey | Date: | Tue, 20 Mar 2012 07:58:19 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/filesystem/functions/ flock.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-9916@lists.php.net to get a copy of this message | ||
aharvey Tue, 20 Mar 2012 07:58:19 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=324378
Log:
Fix doc bug #61436 (Missing fflush() in flock() LOCK_EX example).
Bug: https://bugs.php.net/61436 (Assigned) Missing fflush()
in flock() LOCK_EX example
Changed paths:
U phpdoc/en/trunk/reference/filesystem/functions/flock.xml
Modified: phpdoc/en/trunk/reference/filesystem/functions/flock.xml
===================================================================
--- phpdoc/en/trunk/reference/filesystem/functions/flock.xml 2012-03-20 07:54:14 UTC (rev 324377)
+++ phpdoc/en/trunk/reference/filesystem/functions/flock.xml 2012-03-20 07:58:19 UTC (rev 324378)
@@ -138,10 +138,11 @@
$fp = fopen("/tmp/lock.txt", "r+");
-if (flock($fp, LOCK_EX)) { // do an exclusive lock
- ftruncate($fp, 0); // truncate file
+if (flock($fp, LOCK_EX)) { // acquire an exclusive lock
+ ftruncate($fp, 0); // truncate file
fwrite($fp, "Write something here\n");
- flock($fp, LOCK_UN); // release the lock
+ fflush($fp); // flush output before releasing the lock
+ flock($fp, LOCK_UN); // release the lock
} else {
echo "Couldn't get the lock!";
}