Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Notice that in this code I am using exclusive lock mode (even though all I want to do is read the contents). If I use LOCK_SH it grants a shared lock even if the file is currently openned by another process. Using LOCK_EX I get an errorwhile (defined($_ = readdir(AUDDIR))) { next if /^\.\.?$/; unless (delete $files{$_}) { open(FH, "<$_") or die "Can't open file $_: $!\n"; flock(FH, LOCK_EX) or warn "Can't get exclusive lock on file $_ +: $!\n"; close(FH); } }
This happens regardless of whether the file is still openned or not.Can't get exclusive lock on file ora_6688.aud : Bad file number
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is file still open ?
by cdarke (Prior) on May 15, 2006 at 12:17 UTC | |
|
Re: Is file still open ?
by Thelonius (Priest) on May 15, 2006 at 13:09 UTC | |
by blazar (Canon) on May 15, 2006 at 13:18 UTC | |
|
Re: Is file still open ?
by jonadab (Parson) on May 15, 2006 at 13:14 UTC | |
|
Re: Is file still open ?
by sgifford (Prior) on May 15, 2006 at 14:55 UTC | |
|
Re: Is file still open ?
by Anonymous Monk on May 16, 2006 at 00:41 UTC | |
|
Re: Is file still open ?
by TedPride (Priest) on May 15, 2006 at 19:22 UTC |