Re: [PHP4BETA] flock() - how does this baby work?

From: Date: Sun, 28 May 2000 22:33:42 +0000
Subject: Re: [PHP4BETA] flock() - how does this baby work?
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-15876@lists.php.net to get a copy of this message
You can upgrade or degrade the lock without unlocking first! You can move to a shared lock from an exclusive lock... Try the flock Unix man page. Enjoy! Faisal On Sun, 28 May 2000, August Zajonc wrote: > Looking to lock a file. I acquire the lock twice here, and both times it's > exclusive. Am I missing something here? Does the second flock have to be on > a different file handle? Creating $fp2 pointing to the same file and then > trying to acquire an exclusive lock seemed to block, even with operation set > to 6. > > <? > $fp = fopen("test", "w+"); > if(flock($fp, 2)) > echo "locked"; > if(flock($fp, 2)) > echo "locked"; > ?> > > Output is two locked statements instead of the one I expected. > > August > > > -- > PHP 4.0 Beta Mailing List <http://www.php.net/version4/> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net > For additional commands, e-mail: php4beta-help@lists.php.net > To contact the list administrators, e-mail: php4beta-admin@lists.php.net > >

« previous php.version4 (#15876) next »