summaryrefslogtreecommitdiff
path: root/os2/eg/alarm.pl
blob: e244df47cc684a1975a08033fc5d7453bbb77be5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sub handler {
  local($sig) = @_;
  print "Caught a SIG$sig -- shutting down\n";
  exit(0);
}

$SIG{'ALRM'} = 'handler';
$SIG{'INT'} = 'handler';	# Ctrl-C pressed
$SIG{'BREAK'} = 'handler';	# Ctrl-Break pressed
$SIG{'TERM'} = 'handler';	# Killed by another process

print "Starting execution ...\n";
alarm(10);

while ( <> ) {
}
print "Normal exit.\n";