Branch Coverage

blib/lib/MCE/Hobo.pm
Criterion Covered Total %
branch 164 430 38.1


line true false branch
35 12 0 unless ((caller) =~ /^MCE::/)
46 0 12 $^O eq 'solaris' ? :
0 12 $INC{'POSIX.pm'} ? :
60 0 0 if $INC{'threads.pm'}
69 1 9 if ($cpus eq 'auto') { }
6 3 elsif ($cpus =~ /^([0-9.]+)%$/) { }
76 3 7 if not $cpus =~ /^[\d\.]+$/ or $cpus < 1
91 0 0 if (defined $pkg and $id eq "${$}.$_tid")
100 8 11 if defined $_[0] and $_[0] eq __PACKAGE__
106 0 19 ref $_[0] eq 'HASH' ? :
115 7 12 if defined $_LIST->{$pkg}
117 12 7 unless (defined $_LIST->{$pkg})
118 0 0 if $_tid and $MCE::_GMUTEX
119 0 12 if $_tid
122 12 0 if $INC{'MCE/Shared.pm'}
132 0 0 if $_tid and $MCE::_GMUTEX
135 19 0 unless (exists $mngd->{'posix_exit'})
141 0 19 if $^S or $_tid or $INC{'Mojo/IOLoop.pm'} or $INC{'Coro.pm'} or $INC{'LWP/UserAgent.pm'} or $INC{'stfl.pm'} or $INC{'Curses.pm'} or $INC{'CGI.pm'} or $INC{'FCGI.pm'} or $INC{'Tk.pm'} or $INC{'Wx.pm'} or $INC{'Win32/GUI.pm'} or $INC{'Gearman/Util.pm'} or $INC{'Gearman/XS.pm'}
145 3 16 if (defined $mngd->{'max_workers'})
149 0 19 if ($INC{'LWP/UserAgent.pm'} and not $INC{'Net/HTTP.pm'})
154 5 0 if $mngd->{'on_finish'} and not $INC{'POSIX.pm'} and not $_is_MSWin32
157 0 19 defined wantarray ? :
186 55 0 if $_[0] eq __PACKAGE__
190 0 55 ref $_[0] eq 'HASH' ? :
192 0 55 if $SIG{'CHLD'} eq "IGNORE"
194 0 55 if not ref $_[0] and ref $_[1] eq "CODE"
196 0 0 if not ref $func and length $func and index($func, ":") == -1
199 0 55 unless (defined $func)
208 0 55 if (my $id = ++$$_DATA{"${pkg}:id"}) >= 2000000000
211 0 55 if ($self->{'IGNORE'} or $max_workers and $list->len >= $max_workers)
216 0 0 unless ($hobo->{'REAPED'})
226 0 55 if $max_workers and $list->len >= $max_workers
230 0 0 if $_tid and $MCE::_GMUTEX
237 55 0 if not $_is_MSWin32 and $] ge "5.010001"
240 55 0 unless $_is_MSWin32
244 0 55 if (not defined $pid) { }
46 9 elsif ($pid) { }
250 10 36 if $mngd->{'on_start'}
260 9 0 if $INC{'MCE/Shared.pm'}
261 9 0 unless $self->{'IGNORE'}
262 0 9 if $killed
264 0 9 if $INC{'MCE/Child.pm'}
265 9 0 if $INC{'MCE/Hobo.pm'}
277 0 9 if $INC{'PDL.pm'} and "PDL"->can("srand")
278 0 9 if $INC{'PDL.pm'} and "PDL"->can("srandom")
279 0 9 if $INC{'Math/Prime/Util.pm'}
282 0 9 if ($INC{'Math/Random.pm'})
284 0 0 $cur_seed < 1073741781 ? :
291 0 9 if ($INC{'Math/Random/MT/Auto.pm'})
293 0 0 $cur_seed < 1073741781 ? :
304 0 0 if $_tid and $MCE::_GMUTEX
306 0 46 if $killed
308 46 0 $pid ? :
318 0 0 unless ref $_[0] and ref $_[1]
319 0 0 $_[0]{'WRK_ID'} == $_[1]{'WRK_ID'} ? :
323 0 22 unless ref(my $self = $_[0])
324 0 22 unless $self->{'REAPED'}
325 22 0 unless $self->{'ERROR'}
329 0 10 if defined $_[0] and $_[0] eq __PACKAGE__
331 10 0 ref $_[0] ? :
334 0 10 if ($wrk_id == $$ and $self->{'MGR_ID'} eq "${$}.$_tid") { }
0 10 elsif ($wrk_id == $$) { }
340 0 0 @res ? :
0 0 unless $self->{'IGNORE'}
345 0 10 if $self->{'REAPED'}
347 10 0 if (defined $_DATA->{$pkg}) { }
353 0 10 if ($_is_MSWin32) { }
354 0 0 if CORE::kill "ZERO", $wrk_id
356 10 0 if CORE::kill "ZERO", $wrk_id
363 0 6 if ref $_[0]
364 6 0 if defined $_[0] and $_[0] eq __PACKAGE__
366 5 1 defined $_[0] ? :
368 3 3 if ($pkg eq 'MCE') { }
3 0 elsif (defined $_LIST->{$pkg}) { }
372 0 3 if $MCE::Signal::KILLED
374 3 0 if (exists $_DELY->{$pkg})
388 0 15 unless ref(my $self = $_[0])
391 0 15 if ($wrk_id == $$) { }
15 0 elsif ($self->{'MGR_ID'} eq "${$}.$_tid") { }
395 0 15 if $self->{'REAPED'}
397 15 0 if (waitpid($wrk_id, 1) == 0) { }
398 0 0 unless $self->{'REAPED'}
404 0 0 if $self->{'IGNORE'}
406 0 0 if $self->{'REAPED'}
407 0 0 $_DATA->{$pkg}->exists('R' . $wrk_id) ? :
412 0 15 unless ref(my $self = $_[0])
415 0 15 if ($wrk_id == $$) { }
15 0 elsif ($self->{'MGR_ID'} eq "${$}.$_tid") { }
419 0 15 if $self->{'REAPED'}
421 15 0 if (waitpid($wrk_id, 1) == 0) { }
422 0 0 unless $self->{'REAPED'}
428 0 0 if $self->{'IGNORE'}
430 0 0 if $self->{'REAPED'}
431 0 0 $_DATA->{$pkg}->exists('R' . $wrk_id) ? :
436 0 36 unless ref(my $self = $_[0])
439 0 36 if ($self->{'REAPED'})
440 0 0 unless exists $self->{'RESULT'}
441 0 0 if defined $_LIST->{$pkg}
444 0 0 wantarray ? :
0 0 defined wantarray ? :
448 0 36 if ($wrk_id == $$) { }
36 0 elsif ($self->{'MGR_ID'} eq "${$}.$_tid") { }
453 0 36 if ($_tid) { }
467 0 0 if $self->{'IGNORE'}
473 0 36 unless exists $self->{'RESULT'}
476 0 33 wantarray ? :
33 3 defined wantarray ? :
481 0 5 unless ref(my $self = $_[0])
484 0 5 if ($wrk_id == $$)
488 5 0 if ($self->{'MGR_ID'} eq "${$}.$_tid")
489 0 5 if $self->{'REAPED'}
490 5 0 if (defined $_DATA->{$pkg}) { }
497 5 0 if CORE::kill "ZERO", $wrk_id
503 0 5 if ref $_[0]
506 5 0 defined $_LIST->{$pkg} ? :
510 0 5 if ref $_[0]
513 5 0 defined $_LIST->{$pkg} ? :
517 0 5 if ref $_[0]
520 0 5 unless my $list = $_LIST->{$pkg}
524 15 0 if (waitpid($_->{'WRK_ID'}, 1) == 0) { }
525 0 0 unless $_->{'REAPED'}
533 0 5 if ref $_[0]
536 0 5 unless my $list = $_LIST->{$pkg}
540 15 0 if (waitpid($_->{'WRK_ID'}, 1) == 0) { }
541 0 0 unless $_->{'REAPED'}
549 0 17 if ref $_[0]
554 17 0 if $_[0] eq __PACKAGE__
556 7 10 if @_
561 0 5 if ref $_[0]
564 5 0 defined $_LIST->{$pkg} ? :
568 22 0 if (ref $_[0]) { }
572 0 7 unless ref(my $self = $_[0])
573 0 7 unless $self->{'REAPED'}
575 0 7 unless exists $self->{'RESULT'}
576 0 7 if (wantarray) { }
580 0 0 if ref $_[0]
581 0 0 exists $_SELF->{'PKG'} ? :
587 0 0 ref $_[0] ? :
591 0 1 if ref $_[0]
595 0 0 wantarray ? :
0 1 unless defined $_LIST->{$pkg} and $_LIST->{$pkg}->len
599 0 1 wantarray ? :
605 0 4 if ref $_[0]
609 0 4 unless defined $_LIST->{$pkg} and $_LIST->{$pkg}->len
617 0 0 if ref $_[0]
618 0 0 if defined $_[0] and $_[0] eq __PACKAGE__
628 0 0 unless $_DELY->{$pkg}
641 0 0 if ($INC{'MCE.pm'}) { }
656 0 9 if $_is_MSWin32
660 9 0 if defined fileno STDERR
661 9 0 if defined fileno STDOUT
666 0 9 exists $_SELF->{'hobo_timeout'} ? :
669 0 9 exists $_SELF->{'void_context'} ? :
678 0 9 if ($void_context or $_SELF->{'IGNORE'}) { }
688 0 9 if $timed_out
690 0 9 if ($@) { }
691 0 0 if $@ =~ /^Hobo exited \(\S+\)$/
694 0 0 unless ($_SELF->{'IGNORE'})
699 0 0 unless ($timed_out or $mngd->{'on_finish'} or $INC{'MCE/Simple.pm'})
704 0 9 if ref($res[0]) =~ /^MCE::(?:Barrier|Semaphore)::_guard/s
706 9 0 @res ? :
9 0 unless $_SELF->{'IGNORE'}
716 0 9 if not $_SELF->{'SIGNALED'} and keys %{$_LIST;}
719 9 0 unless $_tid
722 0 9 if $INC{'threads.pm'} and $_is_MSWin32
723 0 9 if $_SELF->{'SIGNALED'} and not $_is_MSWin32
726 0 9 exists $_SELF->{'posix_exit'} ? :
728 0 9 if ($posix_exit and not $_is_MSWin32)
730 0 0 if $INC{'POSIX.pm'}
739 10 0 unless defined $_LIST->{$pkg} and $_LIST->{$pkg}->len
742 0 0 if $hobo->{'IGNORE'}
744 0 0 if ($hobo->is_running)
745 0 0 if CORE::kill "ZERO", $hobo->pid
753 0 0 if $count and not $_is_MSWin32
760 0 0 if $MCE::Signal::IPC
766 0 0 if exists $SIG{$name}
768 0 0 unless ($_SELF->{'IGNORE'})
778 0 40 unless $hobo and defined $hobo->{'PKG'}
782 25 15 length $_[0] ? :
785 0 40 if $hobo->{'IGNORE'}
790 0 40 if ($code > 100 and not $err)
791 0 0 if $code == 101
792 0 0 if $code == 102
793 0 0 if $code == 106
794 0 0 if $code == 111
795 0 0 if $code == 115
800 7 33 if (my $on_finish = $$_MNGD{$hobo->{'PKG'}}{'on_finish'})
811 0 0 if $MCE::Signal::IPC
817 0 0 if exists $SIG{$name}
819 0 0 if ($name eq 'HUP') { }
0 0 elsif ($name eq 'INT') { }
0 0 elsif ($name eq 'ABRT') { }
0 0 elsif ($name eq 'SEGV') { }
0 0 elsif ($name eq 'TERM') { }
825 0 0 unless ($_SELF->{'IGNORE'})
840 0 1120 if $hobo->{'REAPED'}
841 4 1116 if waitpid $wrk_id, 1
843 4 1116 if $self
864 12 0 unless (defined $delay)
865 0 12 $^O =~ /mswin|mingw|msys|cygwin/i ? :
875 0 0 defined $how_long ? :
879 0 0 if (not $delay && defined $lapse) { }
0 0 elsif ($lapse + $delay - $time < 0) { }
904 0 12 $^O eq 'solaris' ? :
0 12 $INC{'POSIX.pm'} ? :
921 0 0 if substr($key, 0, 1) eq "R"
930 0 40 if ($wait_flag)
932 0 0 if (${$self;}->exists('R' . $wrk_id)) { }
934 0 0 unless (${$self;}->exists('R' . $wrk_id))
935 0 0 if waitpid $wrk_id, 1
963 0 40 unless defined(my $off = delete $self->[2]{$key})
969 18 22 if (++$self->[3] > @{$self->[1];} * "0.667")
973 0 40 if defined $k
983 0 46 if exists $self->[0]{$key}
995 0 1141 $self->[3] ? :