in reply to Trouble implementing threads
for($ii=0;$ii<=$count;$ii++) { $thr="thread".$ii; print $thr,"\n"; # $$thr->join(); # don't join here } make a loop that waits for each thread as they finish # JOIN ALL THREADS # untested, but close :-) my @returns; while(1) foreach my $thread (threads->list) { if ($thread->is_joinable() ) { push @returns, $thread->join; } if( scalar (threads->list) == 0 ) { last} } print "@returns\n"; __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Trouble implementing threads
by saranrsm (Acolyte) on Oct 21, 2011 at 10:11 UTC | |
by zentara (Cardinal) on Oct 21, 2011 at 11:14 UTC |