Re: [PHP4BETA] flock() - how does this baby work?
[email protected] (Faisal Nasim)
| Newsgroups | php.version4 |
|---|---|
| Message-ID | <[email protected]> |
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: [email protected]
> For additional commands, e-mail: [email protected]
> To contact the list administrators, e-mail: [email protected]
>
>