Liam Gibbs wrote:
> <<Is there a way for a script to tell if the file it's
> trying to access is locked by other script (via
> flock()) or not. I need to make script wait untill
> other script running in a parallel thread releases the
> lock on  the file.>>
> 
> Without testing, would this work? Just a suggestion
> (read: shot in the dark) that may work.
> 
> while(!$filehandle) {
>    $filehandle = @fopen("file_in_question",
> "r/w/whatever");
> }
> 
> 
> <<Tnx in advance.>>
> 
> You're welcome in advance. :)
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/

How is it possible that the file locked with exclusive lock can be 
opened by another call to fopen in the same script? Am i getting it all 
wrong, or the second call to fopen in the next code should fail?

$fp=fopen("somefile", "w");
flock($fp, LOCK_EX);
$fp1=fopen("somefile", "w");

I'm using php 4.1.2 windows version on apache 1.2.23.

Armin


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

Reply via email to