summaryrefslogtreecommitdiff
path: root/os2/eg/alarm.pl
diff options
context:
space:
mode:
Diffstat (limited to 'os2/eg/alarm.pl')
-rw-r--r--os2/eg/alarm.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/os2/eg/alarm.pl b/os2/eg/alarm.pl
new file mode 100644
index 0000000000..8ceb4e2ba8
--- /dev/null
+++ b/os2/eg/alarm.pl
@@ -0,0 +1,16 @@
+sub handler {
+ local($sig) = @_;
+ print "Caught a SIG$sig -- shutting down\n";
+ exit(0);
+}
+
+$SIG{'INT'} = 'handler';
+$SIG{'QUIT'} = 'handler';
+$SIG{'ALRM'} = 'handler';
+
+print "Starting execution ...\n";
+alarm(10);
+
+while ( <> ) {
+}
+print "Normal exit.\n";