$SIG{INT} = sub { print "got a signal\n"; ## Empty the work queue $Qdownload->dequeue while $Qdownload->pending; ## And stack an undef for each fetcher to abort their main loops $Qdownload->enqueue( (undef) x @downloaders ); $stop = 1; };