Instead of creating a new thread, create 10 threads which take their work from a central queue:
my $threadcount = 10; my $jobs = Thread::Queue->new(@xyz); # I use undef as marker when to stop working $jobs->enqueue(undef) for 1..$threadcount; my @workers = map { threads->create( \&work ) } 1..$threadcount; sub work { while (defined (my $item = $jobs->dequeue)) { print "Processing $item\n"; }; };
But maybe I'm misunderstanding the problem you're trying to solve.
In reply to Re: Help needed with regard to arrays
by Corion
in thread Help needed with regard to arrays
by theknightsofni
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |