There's more than one way to do things | |
PerlMonks |
(atl: about exceptions) RE: RE: race condition? - flock and $SIG{ALRM}by atl (Pilgrim) |
on Sep 18, 2000 at 14:35 UTC ( [id://32936]=note: print w/replies, xml ) | Need Help?? |
Thus spoke Zarathustra: One thing I didn't mention in my post, is that most of those die()'s are actually replaced with a call to an exception handler I wrote ... 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 Section
Seekers of Perl Wisdom
|
|