| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||