Understanding flock()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Im trying to simulate conditions, to see how flock works.
Can anyone verify with the example code below,
that data, never gets written to the file.
//1 & //2 are supposed to be processes???
For me, the var_dump() reports ->
int(7) bool(false)
Thanks

$fp = fopen('foo.txt', 'w'); //1
flock($fp, LOCK_EX) or die('Unable to lock'); //1
unlink('foo.txt') or die('Unable to remove foo.txt'); //2
$bytes = fwrite($fp, 'testing'); //1
fclose($fp); //1
var_dump($bytes, file_get_contents('foo.txt')); //1

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux