line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sandy::InterlaceProcesses; |
2
|
|
|
|
|
|
|
# ABSTRACT: Interlaces the processe id for differents processes, actually for parent, child processes. |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
53
|
use App::Sandy::Base 'class'; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.24'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'foreign_pid' => ( |
9
|
|
|
|
|
|
|
is => 'ro', |
10
|
|
|
|
|
|
|
isa => 'ArrayRef[Int]', |
11
|
|
|
|
|
|
|
required => 1 |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '_signal_stack' => ( |
15
|
|
|
|
|
|
|
traits => ['Array'], |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
18
|
|
|
|
|
|
|
default => sub { [] }, |
19
|
|
|
|
|
|
|
handles => { |
20
|
|
|
|
|
|
|
_add_signal => 'push', |
21
|
|
|
|
|
|
|
signal_catched => 'count', |
22
|
|
|
|
|
|
|
join_signals_received => 'join' |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub BUILD { |
27
|
8
|
|
|
8
|
0
|
68
|
my $self = shift; |
28
|
8
|
|
|
|
|
132
|
$SIG{TERM} = $self->_handle_signal; |
29
|
8
|
|
|
|
|
133
|
$SIG{INT} = $self->_handle_signal; |
30
|
8
|
|
|
|
|
106
|
$SIG{QUIT} = $self->_handle_signal; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _handle_signal { |
34
|
24
|
|
|
24
|
|
103
|
my $self = shift; |
35
|
|
|
|
|
|
|
return sub { |
36
|
0
|
|
|
0
|
|
|
my $signame = shift; |
37
|
0
|
0
|
|
|
|
|
unless ($self->signal_catched) { |
38
|
0
|
|
|
|
|
|
$self->_add_signal($signame); |
39
|
0
|
|
|
|
|
|
my $cnt = kill 'TERM' => @{ $self->foreign_pid }; |
|
0
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
24
|
|
|
|
|
1071
|
}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=encoding UTF-8 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
App::Sandy::InterlaceProcesses - Interlaces the processe id for differents processes, actually for parent, child processes. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
version 0.24 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHORS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
J. Leonel Buzzo <lbuzzo@mochsl.org.br> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Felipe R. C. dos Santos <fsantos@mochsl.org.br> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Helena B. Conceição <hconceicao@mochsl.org.br> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Rafael Mercuri <rmercuri@mochsl.org.br> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by Teaching and Research Institute from Sírio-Libanês Hospital. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software, licensed under: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |