note 26538 added to function.flock
| From: | lubcecco at hotmail dot com | Date: | Mon, 04 Nov 2002 01:44:23 +0000 |
| Subject: | note 26538 added to function.flock | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38936@lists.php.net to get a copy of this message | ||
about: wouldblock
---
<?php
$file= fopen("test.txt","a");
if ( flock ( $file, LOCK_EX, FALSE ) )
fwrite ( $file, "ok..."."\n" );
else
echo "It's busy!";
flock( $file, LOCK_UN );
fclose ( $file );
?>
---
If "wouldblock" flag isn't set to TRUE and $file is locked by another program, this
program return me "It's busy!" or wait for unlock? Thanx...
--
http://www.php.net/manual/en/function.flock.php
http://master.php.net/manage/user-notes.php?action=edit+26538
http://master.php.net/manage/user-notes.php?action=delete+26538
http://master.php.net/manage/user-notes.php?action=reject+26538