my $time = 3600; #or some number of seconds launch_tests(); $SIG{ALRM} = 'ALRM_handler'; my $alrm = $time + 35; #little extra time for init and close alarm $alrm; my $err_count = recv_results(); $die = 1; #this will force any threads that are still stuck in the while loop to exit