Hrrm, that's weird because (quoting from APUE 1st ed, p373):

2. Locks are never inherited by the child across a fork. This means that if a process obtains a lock and then calls fork, the child is considered "another process" with regard to the lock that was obtained by the parent. The child has to call fcntl to obtain its own locks on any descriptors that were inherited across the fork. . . .

And I just looked and OS X has the same verbiage as FreeBSD does (not to surprising, of course :). This may be a BSD-vs-POSIX-vs-SysV thing; at any rate check your OS's flock(2) docs. (Heh. "flock doc" . . .)

--
We're looking for people in ATL


In reply to Re^2: Fork + Flock = Who Gets the Lock? by Fletch
in thread Fork + Flock = Who Gets the Lock? by Anonymous Monk

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.