summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLeon Timmermans <fawaka@gmail.com>2011-01-17 16:29:11 +0100
committerFather Chrysostomos <sprout@cpan.org>2011-01-17 22:31:27 -0800
commit0c1bf4c7d433bb0ad80bfe5511b1301db32b7b95 (patch)
treee204145014553294d06ca1b5c145d1cb6cb87c96 /t
parentf5a55acdcac97456fa66e83ac3d005677b14cc00 (diff)
downloadperl-0c1bf4c7d433bb0ad80bfe5511b1301db32b7b95.tar.gz
Added tests for conditional unblocking
Diffstat (limited to 't')
-rw-r--r--t/op/sigdispatch.t26
1 files changed, 25 insertions, 1 deletions
diff --git a/t/op/sigdispatch.t b/t/op/sigdispatch.t
index 5d9908e6ed..a86861e1af 100644
--- a/t/op/sigdispatch.t
+++ b/t/op/sigdispatch.t
@@ -7,8 +7,9 @@ BEGIN {
}
use strict;
+use Config;
-plan tests => 4;
+plan tests => 9;
watchdog(10);
@@ -36,3 +37,26 @@ eval {
};
is($@, "Alarm!\n", 'after the second loop');
+
+SKIP: {
+ skip('We can\'t test blocking without sigprocmask', 3) if $ENV{PERL_CORE_MINITEST} || !$Config{d_sigprocmask};
+
+ require POSIX;
+ my $new = POSIX::SigSet->new(&POSIX::SIGUSR1);
+ POSIX::sigprocmask(&POSIX::SIG_BLOCK, $new);
+
+ my $gotit = 0;
+ $SIG{USR1} = sub { $gotit++ };
+ kill SIGUSR1, $$;
+ is $gotit, 0, 'Haven\'t third received signal yet';
+
+ my $old = POSIX::SigSet->new();
+ POSIX::sigsuspend($old);
+ is $gotit, 1, 'Received third signal';
+
+ kill SIGUSR1, $$;
+ is $gotit, 1, 'Haven\'t fourth received signal yet';
+ POSIX::sigprocmask(&POSIX::SIG_UNBLOCK, $new, $old);
+ ok $old->ismember(&POSIX::SIGUSR1), 'SIGUSR1 was still blocked';
+ is $gotit, 2, 'Received fourth signal';
+}