sub main_loop { my $parser_thread; while( schedule_count() and $hit_count < $hit_limit #could be commented out and time() < $expiration and ! $QUIT_NOW and scalar threads->list(threads::running) <= 25 ) { #yield(); $parser_thread = async { process_url( next_scheduled_url() );}; } $parser_thread->join; return; }