Understanding flock()

From: Date: Thu, 30 Dec 2004 15:17:32 +0000
Subject: Understanding flock()
Groups: php.general 
Request: Send a blank email to php-general+get-205360@lists.php.net to get a copy of this message
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

« previous php.general (#205360) next »