line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BGS::Limit; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
266160
|
use strict; |
|
4
|
|
|
|
|
40
|
|
|
4
|
|
|
|
|
100
|
|
4
|
4
|
|
|
4
|
|
16
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
88
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
16
|
use Exporter; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
244
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
8
|
|
|
|
|
|
|
our @EXPORT = qw(bgs_call bgs_back bgs_wait bgs_break); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
896
|
use BGS (); |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
800
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my @jobs = (); |
16
|
|
|
|
|
|
|
|
17
|
12
|
|
|
12
|
0
|
44
|
sub bgs_call(&$) { push @jobs, \@_ } |
18
|
12
|
|
|
12
|
0
|
512
|
sub bgs_back(&) { shift } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub do_job { |
22
|
11
|
100
|
|
11
|
0
|
110
|
my $job = shift @jobs or return; |
23
|
9
|
|
|
|
|
43
|
my ($sub, $callback) = @$job; |
24
|
|
|
|
|
|
|
&BGS::bgs_call($sub, sub { |
25
|
4
|
|
|
4
|
|
14
|
my $r = shift; |
26
|
4
|
|
|
|
|
19
|
$callback->($r); |
27
|
4
|
|
|
|
|
5128
|
do_job(); |
28
|
9
|
|
|
|
|
95
|
}); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub bgs_wait($) { |
33
|
4
|
|
|
4
|
0
|
28
|
my ($max) = @_; |
34
|
4
|
50
|
|
|
|
20
|
if ($max) { |
35
|
4
|
|
|
|
|
24
|
do_job() foreach 1 .. $max; |
36
|
2
|
|
|
|
|
30
|
BGS::bgs_wait(); |
37
|
|
|
|
|
|
|
} else { |
38
|
0
|
|
|
|
|
|
foreach (@jobs) { |
39
|
0
|
|
|
|
|
|
my ($sub, $callback) = @$_; |
40
|
0
|
|
|
|
|
|
my $r = $sub->(); |
41
|
0
|
|
|
|
|
|
$callback->($r); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub bgs_break() { |
48
|
0
|
|
|
0
|
0
|
|
@jobs = (); |
49
|
0
|
|
|
|
|
|
BGS::bgs_break(); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |