#!/opt/perl/bin/perl
use strict;
use warnings;
print "set handler 1\n";
$SIG{ALRM} = sub { print "handler 1\n"; };
print "set handler 2\n";
$SIG{ALRM} = sub { print "handler 2\n"; };
print "set handler 3 (local)\n";
{
local $SIG{ALRM} = sub { print "handler 3\n"; };
}
####
write(1, "set handler 1\n", 14set handler 1
) = 14
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80a3330, [], 0}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(1, "set handler 2\n", 14set handler 2
) = 14
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80a3330, [], 0}, {0x80a3330, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(1, "set handler 3 (local)\n", 22set handler 3 (local)
) = 22
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {SIG_DFL}, {0x80a3330, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80a3330, [], 0}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80a3330, [], 0}, {0x80a3330, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(0) = ?
####
#!/opt/perl/bin/perl
use strict;
use warnings;
use Data::Dumper;
print "set handler 1\n";
$SIG{ALRM} = sub { print "handler 1\n"; };
print "set handler 2\n";
$SIG{ALRM} = sub { print "handler 2\n"; };
print "set handler 3 (local)\n";
{
local $SIG{ALRM};
print "\$SIG{ALRM} is now local: " . Dumper($SIG{ALRM});
$SIG{ALRM} = sub { print "handler 3\n"; };
print "\$SIG{ALRM} is now set locally: " . Dumper($SIG{ALRM});
}
####
write(1, "set handler 1\n", 14set handler 1
) = 14
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80a3330, [], 0}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(1, "set handler 2\n", 14set handler 2
) = 14
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80a3330, [], 0}, {0x80a3330, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(1, "set handler 3 (local)\n", 22set handler 3 (local)
) = 22
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {SIG_DFL}, {0x80a3330, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(1, "$SIG{ALRM} is now local: $VAR1 ="..., 37$SIG{ALRM} is now local: $VAR1 = '';
) = 37
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80a3330, [], 0}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(1, "$SIG{ALRM} is now set locally: $"..., 56$SIG{ALRM} is now set locally: $VAR1 = sub { "DUMMY" };
) = 56
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80a3330, [], 0}, {0x80a3330, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(0) = ?