in reply to Re^2: Waiting for multiple filehandles (threads)
in thread Waiting for multiple filehandles

Anyone using threads in Perl should read Things you need to know before programming Perl ithreads.

Update: I guess I should clarify my position a bit, since I seem to have ruffled BrowserUk's feathers with this post. For me, personally, myself, in my code, on my machine, I agree with merlyn. I might consider using lightweight threads, but Perl's are not. They seem like a bad imitation of a real fork. I think the design of Perl's threads is broken, not the idea of threads in general.

That being said, I was not trying to persuade anybody not to use threads. If I was, I would have said so. I was simply trying to refer to an article that brings up an important caveat about Perl's threads. As I said later, I think it's important that people know about this caveat. It makes Perl's threads -- as designed and implemented -- distinct from the common understanding of what threads are, and it deserves to be highlighted and explained to folks who are using them.

  • Comment on Re^3: Waiting for multiple filehandles (threads)

Replies are listed 'Best First'.
Re^4: Waiting for multiple filehandles (threads)
by merlyn (Sage) on Mar 22, 2005 at 19:16 UTC
    Anyone using threads in Perl
    ... won't be dropping their code into production on any box I control. That's another thing to keep in mind. Maybe threads are good for Windows, but on Unix, threads are spelled "f-o-r-k". Forking technology is far better developed and understood and optimized on Unix.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^4: Waiting for multiple filehandles (threads)
by BrowserUk (Patriarch) on Mar 22, 2005 at 18:57 UTC

    Actually, I think that about 50% of that article is out of date, and another 20% is the author's misunderstanding.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco.
    Rule 1 has a caveat! -- Who broke the cabal?

      I think I just heard someone just volunteer to write a new threads tutorial for perlmonks... ;-)

        If, as and when I believe I know enough about threads to write an authorative tutorial, I will.

        Until that time, I will continue to try gain that knowledge, by showing how simple and effective threads can be for some applications, and to debunk the pervasive FUD that surrounds them.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco.
        Rule 1 has a caveat! -- Who broke the cabal?
      The main point of the article I posted was that Perl's ithreads are not lightweight. The details may be off, but unless something drastic has changed (which is entirely possible. Please correct me if it has), this basic fact still holds true. It is something everyone who writes threaded code in Perl should know.
      A reply falls below the community's threshold of quality. You may see it by logging in.