Just a short note: if you catch the exception instead of letting the process die, you´ll have to close the file yourself to get rid of the lock. Otherwise you might block other processes in the (rather rare) case the race condition occurs.
As for using an exception or not ... if you need this file lock to continue normally, not getting it (including timeout) should be considered an exceptional condition. But that´s a matter of programming style, certainly no "rigth" or "wrong" way ...
Beers! Yup! :-))
Andreas
In reply to (atl: about exceptions) RE: RE: race condition? - flock and $SIG{ALRM}
by atl
in thread race condition? - flock and $SIG{ALRM}
by Zarathustra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |