http://www.perlmonks.org?node_id=258412

P0w3rK!d has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I was unable to find a tutorial on threading with Perl in the Tutorials section. Also, there appears to be nothing written but a table of contents here:

#perlthrtut---tutorial-on-threads-in-Perl

#perlothrtut---old-tutorial-on-threads-in-Perl

..and yes..they are the same link..it appears that neither of them have been written yet. :(

Does any one out there have any links they can share with the monestary on best practices for threading with Perl?

Thanks :)

-P0w3rK!d

Replies are listed 'Best First'.
Re: Threading - Best Practices
by hardburn (Abbot) on May 15, 2003 at 15:51 UTC

    There is this perl.com article on the new perl 5.8.0 threading system.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Re: Threading - Best Practices
by jsprat (Curate) on May 15, 2003 at 16:13 UTC
    The tutorial has been written - try this link perlthrtut and hit the first link. Or just type perldoc perlthrtut at a command prompt or shell. Or, if you have ActiveState Perl, all the documentation (including the threading tutorial) is available locally in html format as well as the pod.

    You may want to look at How to RTFM, lots of good advice. Good luck

      Thank you :)

      BTW-I did RTFM. I checked the website and other sources. I also thought it would be a good topic to bring up. Wait before you pull the RTFM trigger next time ;)</>

Re: Threading - Best Practices
by hossman (Prior) on May 15, 2003 at 17:44 UTC

    The problme you are having is because of a missunderstnading of how perldoc.com converts/structures it's docs.

    What you are looking at is the "perltoc" man page, which just lists the table of contents of all the manpages ... those links are the same because they are just designed to link back to the top of the main TOC.

    The Doc you probably want to start from is the "perl" man page, which links to the "perlthrtut man page.

Re: Threading - Best Practices
by tilly (Archbishop) on May 17, 2003 at 20:42 UTC
    Don't.

    Seriously, before you try it, carefully think through why you want threading. Odds are that you don't, really. And there are a lot of potential things that can go wrong which are really hard to debug (specifically race conditions). Unless you have a good reason to open that can of worms, I wouldn't.

      /msg p5p cease development on threads, nobody is going to use them. They are too hard.

        Heh.

        The truth is that people will use threads. Why? First of all they are the best solution to certain classes of user interaction problems. Also a lot of people think that they are cool. And programmers who are used to languages or environments where you thread everywhere just find them familiar. Therefore it makes sense for p5p to try to support them.

        What I would like is for people to not get burned by using threads where it doesn't make sense to.

        For one description of why it sometimes doesn't make sense to use them, see Threads vs Forking (Java vs Perl).