use strict; use warnings; use POSIX; if (my $pid = fork) { sleep 1; alarm 10; kill (POSIX::SIGUSR2, $pid); $SIG{CHLD} = 'IGNORE'; while( wait() != -1 ){ print STDERR "wait\n"}; } else { $SIG{USR2} = sub { print "CHILD $$ EXIT\n"; exit(1); }; sleep 1 while (1); } print STDERR "DONE\n";