Granted, at first I thought it was a global lock, but it appears to be much finer grained than that. Perl's accept will not block all stat operations, just those on the socket passed to accept

Which is where I was coming from. If PerlIO didn't use fstat() to try to determine if a file descriptor belongs to a "regular" file--which is a pretty expensive way of doing it, even if it worked--then that paricular problem would go away.

Similarly for the ftell() which isn't useful on a socket. All of this takes place as a part of PerlIO_dup() when they are cloning. I don't understand why they can't just use the CRT dup() or dup2()?

The lock appears to be specific to a handle or descriptor.

That's partly why I reached the conclusion that it must be in the windows CRT. Why would they lock them for windows and not *nix?

And tracing backward from Win32sck.c:Win32_accept(), darned if I can see anywhere locking is applied. But once you get into PerlIO.c, there are so many layers of macro and indirection through any one of a dozen different flavours of IO layer dispatch tables, I can quite see that I might have missed something. I don't think I did, but I might have.

I would start by finding out which, then finding out where the lock is stored in the relevant structure, then find out what uses the lock.

At this point: be my guest :) I'm done. (For a few days at least.)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

In reply to Re^12: threads + sockets stalling question by BrowserUk
in thread threads + sockets stalling question by BrowserUk

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.