I have several multithreaded services written in Perl (originaly 5.6.1, now 5.8). I usualy use Win32::BiggerPipe (did not find time to make it CPAN ready) to send data to the children and Win32::Semaphore to control the access to the pipe(s). You may see an example (old, probably no longer functioning script to download images from eGroups/YahooGroups groups). It needs IThread::AtFork module (also not on CPAN). You can read up here on what is this module supposed to solve.

I usualy only need to send commands from the main thread to the children, but you might keep the pipes open in the oposite direction as well and send data back. The only thing you have to keep in mind is that pipe reads are blocking under windows (select() doesn't work) so if you do not want the threads to block you have to use the Win32::Semaphores to signal it's safe to read from a pipe. You of course have to be carefull not to read too much or too little.

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature


In reply to Re: Useful fork with IPC on win32 ? by Jenda
in thread Useful fork with IPC on win32 ? by NetWallah

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.