What about:
You'll also note that there's a semicolon after the closing brace. That's because async() treats the following block as an anonymous subroutine, so the semicolon is necessary.
and:
threads->list() returns a list of thread objects, one for each thread that's currently running and not detached. Handy for a number of things, including cleaning up at the end of your program (from the main Perl thread, of course):# Loop through all the threads foreach my $thr (threads->list()) { $thr->join(); }
Is there any difference between threads->create() and async {...}?
In reply to Re: wait for threads to end in parallel
by 7stud
in thread wait for threads to end in parallel
by pmarcoen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |