my $timeToExit : shared = 0; sub shutdown{ print logTime." INT|ABRT|QUIT|TERM received....shutting down service.\n"; $timeToExit = 1; ## Tell the threads to quit sleep 1; ## give them time to react close(LOOK_FOR_LEASE) if fileno(LOOK_FOR_LEASE); close(OUTPUT) if fileno(OUTPUT); close(ERROR) if fileno(ERROR); threads->exit(); } ... my $thread300 = async { my $sleepTime = 300; while( !$timeToExit ) { sleep 1 and next while --$sleepTime; $sleepTime = 300; ... } };