I think what you may want to do is use a semaphore file -- that is, a separate file (which can remain empty) to which you apply flock. Competing processes use the same semaphore file to serialize the use of any shared resource. Each process tries to get a lock on the semaphore, and once it has the lock, it does whatever it needs to do with the shared resource (e.g. move or alter some other data file), then releases the semaphore.

I happen to have posted a semaphore-file module here -- I picked it up and adapted it from a Perl Journal article by Sean Burke a couple years back. Works great on Solaris -- and even on ms-windows (tested on win98/2k).


In reply to Re: Trouble with locking under Solaris by graff
in thread Trouble with locking under Solaris by jadev

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.