OK. Windows mutuxes do not conform to DCE and cannot be applied across machines. I have done this in the past, but it involved named pipes (which, on Windows, are a communications protocol). It is a non-trival task.

There are other sneaky ways of performing IPC if you have shared drives. One is to change the (Windows) attributes of a "well known" shared file (can be empty) in its own folder. You can use Win32::File with GetFileAttributes and SetFile Attributes.

For example, set the READONLY attribute to indicate that the disc is not to be written to, then unset it when you are done. Check that attribute before reading. Unfortunately this means you have to poll the file, or preferably use notification events with Win32::ChangeNotify.

Update: I should have pointed out that using file attributes as a flag is not atomic, and can lead to a race condition. It appeared to me that this is unlikely in your senario, however for a poduction system that could not be tolerated. In that case you would need a service on one of the machine to control access - this is where Named Pipes come in.

In reply to Re^5: Need Advice on Folder/Drive locking by cdarke
in thread Need Advice on Folder/Drive locking by kuldeepchowhan

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.