in reply to wait for threads to end in parallel
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 {...}?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: wait for threads to end in parallel
by ikegami (Patriarch) on Mar 16, 2010 at 16:14 UTC | |
by BrowserUk (Patriarch) on Mar 16, 2010 at 16:31 UTC | |
by ikegami (Patriarch) on Mar 16, 2010 at 16:47 UTC | |
by BrowserUk (Patriarch) on Mar 16, 2010 at 17:11 UTC | |
by ikegami (Patriarch) on Mar 16, 2010 at 18:09 UTC |