line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Event::Signal; |
2
|
|
|
|
|
|
|
|
3
|
110
|
|
|
110
|
|
767
|
use POE::Kernel; |
|
110
|
|
|
|
|
219
|
|
|
110
|
|
|
|
|
3325
|
|
4
|
110
|
|
|
110
|
|
654
|
use POE::Event; |
|
110
|
|
|
|
|
118
|
|
|
110
|
|
|
|
|
2531
|
|
5
|
110
|
|
|
110
|
|
682
|
use base 'POE::Event'; |
|
110
|
|
|
|
|
219
|
|
|
110
|
|
|
|
|
10870
|
|
6
|
|
|
|
|
|
|
|
7
|
110
|
|
|
110
|
|
780
|
use strict; |
|
110
|
|
|
|
|
222
|
|
|
110
|
|
|
|
|
3796
|
|
8
|
110
|
|
|
110
|
|
659
|
use warnings; |
|
110
|
|
|
|
|
219
|
|
|
110
|
|
|
|
|
39527
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $flag; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub dispatch { |
13
|
101
|
|
|
101
|
0
|
186
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
101
|
|
|
|
|
315
|
my $kernel = $self->[POE::Event::KERNEL]; |
16
|
101
|
|
|
|
|
218
|
my $time = $self->[POE::Event::TIME]; |
17
|
101
|
|
|
|
|
304
|
my $sender = $self->[POE::Event::FROM]; |
18
|
101
|
|
|
|
|
222
|
my $session = $self->[POE::Event::TO]; |
19
|
101
|
|
|
|
|
268
|
my $signal = $self->[POE::Event::NAME]; # I think |
20
|
101
|
|
|
|
|
192
|
my $args = $self->[POE::Event::ARGS]; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Reset the sig_handled flag |
23
|
|
|
|
|
|
|
# $flag = 0; # not thread safe |
24
|
101
|
|
|
|
|
244
|
local $flag = 0; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# This algorithm is copied pretty much verbatim from POE's Kernel.pm, it's very elegant anyways. |
27
|
|
|
|
|
|
|
|
28
|
101
|
|
|
|
|
89274
|
my @touched_sessions = ($session); |
29
|
101
|
|
|
|
|
161
|
my $touched_index = 0; |
30
|
101
|
|
|
|
|
352
|
while ($touched_index < @touched_sessions) { |
31
|
103
|
|
|
|
|
194
|
my $next_target = $touched_sessions[$touched_index]; |
32
|
103
|
|
|
|
|
558
|
push @touched_sessions, $kernel->get_children($next_target); |
33
|
103
|
|
|
|
|
317
|
$touched_index++; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
101
|
50
|
|
|
|
546
|
if (my $signal_watchers = $kernel->[POE::Kernel::KR_SIGNALS()]->{$signal}) { |
37
|
101
|
|
|
|
|
295
|
while( $touched_index-- ) { |
38
|
103
|
|
|
|
|
152
|
my $target_session = $touched_sessions[$touched_index]; |
39
|
103
|
100
|
|
|
|
337
|
if (exists( $signal_watchers->{$target_session} )) { |
40
|
102
|
|
|
|
|
528
|
POE::Event->new( |
41
|
|
|
|
|
|
|
$kernel, |
42
|
|
|
|
|
|
|
$time, |
43
|
|
|
|
|
|
|
$sender, |
44
|
|
|
|
|
|
|
$target_session, |
45
|
|
|
|
|
|
|
$signal_watchers->{$target_session}->[1], |
46
|
|
|
|
|
|
|
$args, |
47
|
|
|
|
|
|
|
)->dispatch(); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
101
|
|
|
|
|
529
|
foreach my $dead_session (@touched_sessions) { |
53
|
|
|
|
|
|
|
# Sessions go boom |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Flag not set? KILL ALL HUMANS. |
57
|
|
|
|
|
|
|
# TODO |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub HANDLED { |
61
|
102
|
|
|
102
|
0
|
1239
|
$flag = 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |