in reply to What is the correct way to finish multithreaded program?
While I'm not an expert on threads, I believe this is the problem:
foreach my $thr (@threads) { if ( $thr->is_joinable() ) { $thr->join(); } }
You only join the threads that have already finished; instead you should join them all, i.e. wait for them to finish.
In Section
Seekers of Perl Wisdom