blib/lib/Pipeline/Segment/Async/IThreads.pm

filter: Statementstmt 58.5% 24 / 41 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 80.0% 4 / 5 totaltotal 59.6% 37 / 62 CC 3 SCAR 7.5
CC
3
Cov
56%
thread
6.0
BEGIN
2.3
run
2.0
CRAP 2.1
« blib/lib/Pipeline/Segment/Async.pm ↑ Summary blib/lib/Pipeline/Store.pm »
1 package Pipeline::Segment::Async::IThreads;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our $VERSION = "3.12";
6  
7 1 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=8.1
8 1 ▶ use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶ if ($Config{useithreads}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Pipeline::Segment::Async::IThreads::Config{'useithreads'}) { } 0 1 1
10 0 $Pipeline::Segment::Async::IThreads::AVAILABLE = 1;
11 0 require threads;
12 0 threads->import;
13 } else {
14 1 $Pipeline::Segment::Async::IThreads::AVAILABLE = 0;
15 }
16 }
17  
18 1 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Pipeline::Segment::Async::Handler;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use base qw( Pipeline::Segment::Async::Handler );
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶sub canop {
Subroutine canop: called CC=1 SCAR=0.0
Pod documented
23 1 my $self = shift;
24 1 $Pipeline::Segment::Async::IThreads::AVAILABLE
25 }
26  
27 0 ▶sub run {
Subroutine run: not called CC=1 SCAR=6.9
Pod documented
28 0 my $self = shift;
29 0 my $sub = shift;
30 0 my @args = @_;
31 0 $self->thread( threads->create( $sub, @args ) );
32 }
33  
34 0 ▶sub thread {
Subroutine thread: not called CC=2 SCAR=17.9
Pod undocumented
35 0 my $self = shift;
36 0 my $thread = shift;
37 0 ▶ if (defined( $thread )) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $thread) { } 0 0 0
38 0 $self->{ thread } = $thread;
39 0 return $self;
40 } else {
41 0 return $self->{ thread };
42 }
43 }
44  
45 0 ▶sub reattach {
Subroutine reattach: not called CC=1 SCAR=6.9
Pod documented
46 0 my $self = shift;
47 0 return $self->thread->join();
48 }
49  
50 0 ▶sub discard {
Subroutine discard: not called CC=1 SCAR=6.9
Pod documented
51 0 my $self = shift;
52 0 $self->thread->detach();
53 }
54  
55 1 1;
56  
57 __END__
« blib/lib/Pipeline/Segment/Async.pm ↑ Summary blib/lib/Pipeline/Store.pm »