Update: Incase it is unclear, this post refers ONLY to the situation when using ithreads.

(Though it's also worth remembering that under Win32, fork is emulated using ithreads under the covers.)

It's worth noting that unless you intend using a module in multiple threads, there is little point in loading that module prior to spawning your threads. It only consumes extra memory.

If you do need to use a module in multiple threads, remember that you cannot call methods across threads, or share objects. That is to say, if you create an object in one thread, and share it with another thread and then try to invoke methods upon the object in the second thread, it won't do what you want it to.

It is almost always better to require the modules needed by a thread, from within that thread, once it has started.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

In reply to Re: latest on ithreads vs forks? by BrowserUk
in thread latest on ithreads vs forks? 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.