in reply to Re: use die with flock
in thread use die with flock

A flock can fail, even if the system supports and if you are not using LOCK_NB. See your systems manual page for lockf, flock and fcntl. (Perl can implement flock in different ways, depending on what the OS supports). One reason of failures is when you've reached the systems limit of locks.

It's better to always check the return value of system calls. No harm is done if the system call cannot fail, but much harm could be done if you wrongly assumed it cannot fail, and it failed after all.

The only time you don't need to check the return value of a system call is when you don't care if it fails. But then you should place a comment there, explaining why you aren't checking the return value of the system call.

Abigail