summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-04-17 21:24:21 +0100
committerNicholas Clark <nick@ccl4.org>2010-04-17 21:24:21 +0100
commit8f3964af7ae5331db258ef371ed6879d127851aa (patch)
treeb621aa690692f98d6418e29a3ac9dfeb431c675e /t
parent47550813adf9ff4023595a3d439a9080e8fa9040 (diff)
downloadperl-8f3964af7ae5331db258ef371ed6879d127851aa.tar.gz
Dispatch signals in infinite loops such as 1 while 1;
With the move of PERL_ASYNC_CHECK() out from the runloop to control ops, infinite loops became truely infinite, as their optree has no control ops. Hence add a PERL_ASYNC_CHECK() to pp_unstack to ensure signals will be dispatched. Bug noticed by Jerry Hedden.
Diffstat (limited to 't')
-rwxr-xr-xt/op/sigdispatch.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/op/sigdispatch.t b/t/op/sigdispatch.t
new file mode 100755
index 0000000000..5d9908e6ed
--- /dev/null
+++ b/t/op/sigdispatch.t
@@ -0,0 +1,38 @@
+#!perl -w
+
+# We assume that TestInit has been used.
+
+BEGIN {
+ require './test.pl';
+}
+
+use strict;
+
+plan tests => 4;
+
+watchdog(10);
+
+$SIG{ALRM} = sub {
+ die "Alarm!\n";
+};
+
+pass('before the first loop');
+
+alarm 2;
+
+eval {
+ 1 while 1;
+};
+
+is($@, "Alarm!\n", 'after the first loop');
+
+pass('before the second loop');
+
+alarm 2;
+
+eval {
+ while (1) {
+ }
+};
+
+is($@, "Alarm!\n", 'after the second loop');