http://qs321.pair.com?node_id=1085053


in reply to Re^3: What is the correct way to finish multithreaded program?
in thread What is the correct way to finish multithreaded program?

I'm pushing undef into the queue with
foreach ( 1 .. $config->{number_of_threads} ) { $q->enqueue(undef); }
and I think this will cause thread to return:
while ( my $org = $q->dequeue() ) { parse_org( $org, $mech ); $pq->enqueue($org); } say "Finishing worker [$thread_id]"; return;
Also I have Finishing worker [SOME_ID] in the output...