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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.