Revision: 1082
http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1082&view=rev
Author: gpinzone
Date: 2007-08-04 05:57:44 -0700 (Sat, 04 Aug 2007)
Log Message:
-----------
Simplified initial write by using file_put_contents. TODO: exponential backoff on flock failure.
Modified Paths:
--------------
branches/pfc-comet/misc/flock-tests/readwrite2.php
Modified: branches/pfc-comet/misc/flock-tests/readwrite2.php
===================================================================
--- branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-04 11:32:26 UTC (rev 1081)
+++ branches/pfc-comet/misc/flock-tests/readwrite2.php 2007-08-04 12:57:44 UTC (rev 1082)
@@ -30,18 +30,15 @@
flock($fh, LOCK_UN);
break;
}
- usleep(rand(1000,5000)); // If flock is working properly, this will never be reached
+ // If flock is working properly, this will never be reached
+ usleep(rand(1000,5000)); // TODO: implement exponential backoff
}
fclose($fh);
}
else
{
- $fh = fopen($msgid_filename, 'w');
- flock($fh, LOCK_EX);
$msgid="1";
- fwrite($fh, $msgid);
- flock($fh, LOCK_UN);
- fclose($fh);
+ file_put_contents($msgid_filename, $msgid, LOCK_EX);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|