Letīs analyze what happens, if you get an flock
and die before you can unset the alarm.
- You got the lock, so no other process will
write. Fine.
- You die before unsetting the alarm. Since
this is the first thing you do, thatīs equivalent
to a timeout before. Fine.
- What happens to the flock if your process dies?
Since it is bound to an open filehandle, which getīs
closed among process termination by the OS or even
earlier by the perl interpreter (cleanup), it will
simply vanish. The next process may claim the flock.
Fine.
So far, youīre codeīs fine. As for the reliabilty
of signals ... there is some coverage in the perldocs
and here in the monastry. I donīt have a link handy,
youīll have to try a search.
Have fun ...
Andreas
five days ītil YAPC::Europe ...
Update: BTW, using a nonblocking flock
and putting the process to sleep for a random time
would eliminate the need for signals. Try something
like three tries with varying random sleeping times,
if unsuccessful, give up (i.e. die). Adjust number
of tries and sleeping time for your needs.
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.