my @signals = qw(TERM ALRM INT HUP); for (@signals) { $SIG{$_} = sub { $rt->debug(qq{Caught signal: $_.\n}); kill 9, $pid; $thread->join(); exit; }; }