line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Proc::tored::Pool; |
2
|
|
|
|
|
|
|
# ABSTRACT: managed work pool with Proc::tored and Parallel::ForkManager |
3
|
|
|
|
|
|
|
$Proc::tored::Pool::VERSION = '0.05'; |
4
|
|
|
|
|
|
|
|
5
|
13
|
|
|
13
|
|
1828905
|
use strict; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
286
|
|
6
|
13
|
|
|
13
|
|
39
|
use warnings; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
338
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
13
|
|
|
13
|
|
4784
|
use Proc::tored::Pool::Constants ':events'; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
1612
|
|
9
|
13
|
|
|
13
|
|
4511
|
use Proc::tored::Pool::Manager; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
429
|
|
10
|
13
|
|
|
13
|
|
5473
|
use Proc::tored; |
|
13
|
|
|
|
|
4251
|
|
|
13
|
|
|
|
|
1053
|
|
11
|
|
|
|
|
|
|
|
12
|
13
|
|
|
13
|
|
65
|
use parent 'Exporter'; |
|
13
|
|
|
|
|
13
|
|
|
13
|
|
|
|
|
39
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT = ( |
15
|
|
|
|
|
|
|
@Proc::tored::EXPORT, |
16
|
|
|
|
|
|
|
qw( |
17
|
|
|
|
|
|
|
assignment |
18
|
|
|
|
|
|
|
success |
19
|
|
|
|
|
|
|
failure |
20
|
|
|
|
|
|
|
pool |
21
|
|
|
|
|
|
|
capacity |
22
|
|
|
|
|
|
|
on |
23
|
|
|
|
|
|
|
call |
24
|
|
|
|
|
|
|
pending |
25
|
|
|
|
|
|
|
process |
26
|
|
|
|
|
|
|
) |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
13
|
|
|
13
|
1
|
195
|
sub pool ($%) { Proc::tored::Pool::Manager->new(name => shift, @_); } |
31
|
13
|
|
|
13
|
1
|
78
|
sub capacity ($@) { workers => shift, @_ } |
32
|
39
|
|
|
39
|
1
|
130
|
sub on ($@) { 'on_' . shift, @_ } |
33
|
39
|
|
|
39
|
1
|
9737
|
sub call (&@) { @_ } |
34
|
0
|
|
|
0
|
1
|
0
|
sub pending ($) { $_[0]->pending } |
35
|
0
|
|
|
0
|
1
|
0
|
sub sync ($) { $_[0]->sync } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub process (&$;$) { |
38
|
90
|
|
|
90
|
1
|
245704
|
my $code = shift; |
39
|
90
|
|
|
|
|
129
|
my $pool = shift; |
40
|
90
|
|
|
|
|
140
|
unshift @_, $code; |
41
|
90
|
|
|
|
|
346
|
$pool->assign(@_); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |