Posted on 2009-05-08 12:10:04-07 by jdhedden in response to 10638
Re: Threads join leaves threads running
$thr->join() only joins the thread for object $thr. In your loop, $thr is assigned to the next thread with each iteration.

If you don't need to know anything about the threads other than to join them, you can simply your code to this:
threads->create(\&func, $var) foreach 1..10; $_->join() foreach threads->list();
(Of course, there are other ways you could do this.)
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.