I can't comment much on your design as you didn't post it here. You might want to post (the relevant parts of) your code in addition to your text. Put it in between <code>...</code> tags so it renders and downloads nicely.

As for your design, why are you passing sockets to your worker threads? Just read all the information necessary for a job from the socket, and then pass that information to the worker. That way, you don't need to pass sockets around. Personally, I prefer nonblocking IO for doing socket communications, and I'd have one single thread dedicated to doing the socket IO, which basically maintains a set of buffers for each socket connection and fetches/dispatches/returns the data from the clients to the workers and back.


In reply to Re: Multithreaded server with shared sockets? by Corion
in thread Multithreaded server with shared sockets? by kornerr

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.