12 lines
314 B
Perl
12 lines
314 B
Perl
|
while (-e "flockTest.lck") {
|
||
|
print "waiting for lock\n"; sleep(1.0);
|
||
|
}
|
||
|
|
||
|
open (LOCK, ">flockTest.lck") || die "Lock error $!";
|
||
|
open (OUTFILE, ">>flockTest.txt") || warn $!;
|
||
|
print ("This process now owns the Exclusive lock\n");
|
||
|
|
||
|
$in = <STDIN>;
|
||
|
close (OUTFILE);
|
||
|
close (LOCK);
|
||
|
unlink ("flockTest.lck");
|