Thanks oxone,

I agree with you, its a bit of a state - rest assured it wont end that way. The semaphore was a product of desperation. Its been the sort of week where everything has gone wrong (and its only wednesday!?) and so I was kinda scrabbling at the problem rather than calmly dealing with it.

With regards to not using LOCK_NB, I don't think I can go that way. This script is called, eventually, from a GUI app and I'd rather not leave the user hanging on indefinitely, even if in 99.99% of cases the lock will only exist for fractions of a second. I keep coming over sysopen but have never used it - tbh open() works fine and is what all the scripts here use and I'd rather not move away from that.


In reply to Re^2: flock(), dodgy return? by danstuken
in thread flock(), dodgy return? by danstuken

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.