Thread::Queue is indeed the way to go.
my $q = Thread::Queue->new(); my @threads; for (1..MAX_WORKERS) { push @threads, async { while (my $job = $q->dequeue()) { do_job($job); } }; } # Give work to the workers. for my $job (...) { $q->enqueue($job); } # Signal the workers to exit. $q->enqueue(undef) for 1..MAX_WORKERS; # Wait for the workers to finish. $_->join() for @threads;
In reply to Re^3: Use Coro for reading EventLog on many pc's?
by ikegami
in thread Use Coro for reading EventLog on many pc's?
by gizmo_mathboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |