3 Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
4 Description: PHP supports a portable way of locking complete files
7 <<__EntryPoint
>> function main(): void
{
8 echo "*** Testing flock() fun with the various operation and
9 wouldblock values ***\n";
10 $file = __SystemLib\
hphp_test_tmppath('flock.tmp');
11 $fp = fopen($file, "w");
13 /* array of operatons */
27 /* array of wouldblocks */
28 $wouldblocks = varray
[
47 foreach($operations as $operation) {
48 echo "--- Outer iteration $i ---\n";
50 var_dump(flock($fp, (int)$operation, inout
$wouldblock));
52 foreach($wouldblocks as $wouldblock) {
53 echo "-- Inner iteration $j in $i --\n";
54 var_dump(flock($fp, (int)$operation, inout
$wouldblock));
63 echo "\n*** Done ***\n";