On 6/11/07, oryann9 <[EMAIL PROTECTED]> wrote:
snip
If you use LOCK_NB and are refused a LOCK_SH, then you
know that someone else has a LOCK_EX and is updating
the file. If you are refused a LOCK_EX, then someone
holds either a LOCK_SH or a LOCK_EX, so you shouldn't
try to update the file.
snip
use Fcntl qw(:flock);
until(flock $fh, LOCK_EX|LOCK_NB)
{
$lockwait++;
if($lockwait == 10)
{
print STDERR "timed out waiting for lock\n";
exit 1;
}
sleep 1;
}
this will do a non-blocking attempt to get the lock, and try 10 t
look in to the alarm() function
perldoc -f alarm
+Pete
--
[EMAIL PROTECTED]
;;($_='Yw_xUabcdtefgdijktljkotiersjkUzxT
yvlkbfdtcierstajogvPruntRshackRJelov')=~
y&/RTUv;wxYz$&/ ~'/;$=();$&&&eval&&print
<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I'