Hi,
Might not be what you want as you already have the support for the lockfiles in each directory, perhaps from other tasks but....
Rather than having a lock file in each directory, just maintain a file that has the paths of the directories that allowed to be visited/have been processed. As you would be traversing the list sequentially you would not have to worry about doing things out of order.
Everytime you complete a task for a particular directory you could save the line number (which directory you did last) to another file so you could restart if the script bailed out for some reason.
An advantage of this is you don't have to skip in and out of all the directories to see if you need to do work. The list maintains where the work is to be done.
Just a thought... =)

Regards Paul.

In reply to Re: Locking/unlocking program execution using a queue by thekestrel
in thread Locking/unlocking program execution using a queue by RazorbladeBidet

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.