| 1 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 2 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Hybrid (normal and priority) queues. | ||||||||||||||||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 5 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | package MCE::Queue; | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 37 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 37 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 37 | ▶ | no warnings qw( threads recursion uninitialized ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 37 | our $VERSION = '1.904'; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | ## no critic (Subroutines::ProhibitExplicitReturnUndef) | ||||||||||||||||||||||||||||||||||||||||||
| 17 | ## no critic (TestingAndDebugging::ProhibitNoStrict) | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 37 | ▶ | use Scalar::Util qw( looks_like_number ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 37 | ▶ | use MCE::Util qw( $LF ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 37 | ▶ | use MCE::Mutex (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 24 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 25 | ## Import routine. | ||||||||||||||||||||||||||||||||||||||||||
| 26 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 27 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 37 | our ($HIGHEST,$LOWEST, $FIFO,$LIFO, $LILO,$FILO) = (1,0, 1,0, 1,0); | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 37 | ▶ | my $_is_MSWin32 = ($^O eq 'MSWin32') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 37 | my ($_def, $_imported) = ({}); | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 39 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=8 SCAR=21.5
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 39 | my ($_class, $_pkg) = (shift, caller); | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | ## Process module arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 39 | my $_p = $_def->{$_pkg} = { | |||||||||||||||||||||||||||||||||||||||||
| 39 | AWAIT => 0, PORDER => $HIGHEST, TYPE => $FIFO, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 39 | ▶ | while (my $_argument = shift) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $_arg = lc $_argument; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | $_p->{AWAIT } = shift, next if ( $_arg eq 'await' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | $_p->{PORDER} = shift, next if ( $_arg eq 'porder' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | $_p->{TYPE } = shift, next if ( $_arg eq 'type' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | _croak("Error: ($_argument) invalid module option"); | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 39 | ▶ | return if $_imported++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | ## Define public methods to internal methods. | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 37 | ▶ | no strict 'refs'; no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 37 | ▶ | if ($INC{'MCE.pm'} && MCE->wid == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$INC{"MCE.pm"} and "MCE"->wid == 0
MC/DC50%1/2
$INC{"MCE.pm"} and "MCE"->wid == 0
$INC{"MCE.pm"}
"MCE"->wid == 0
Truth table66%2/3
A and B
A= $INC{"MCE.pm"}B= "MCE"->wid == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 35 | _mce_m_init(); | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 37 | *{ 'MCE::Queue::await' } = \&_mce_m_await; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 37 | *{ 'MCE::Queue::clear' } = \&_mce_m_clear; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 37 | *{ 'MCE::Queue::end' } = \&_mce_m_end; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 37 | *{ 'MCE::Queue::enqueue' } = \&_mce_m_enqueue; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 37 | *{ 'MCE::Queue::enqueuep' } = \&_mce_m_enqueuep; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 37 | *{ 'MCE::Queue::dequeue' } = \&_mce_m_dequeue; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 37 | *{ 'MCE::Queue::dequeue_nb' } = \&_mce_m_dequeue_nb; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 37 | *{ 'MCE::Queue::dequeue_timed' } = \&_mce_m_dequeue_timed; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 37 | *{ 'MCE::Queue::pending' } = \&_mce_m_pending; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 37 | *{ 'MCE::Queue::insert' } = \&_mce_m_insert; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 37 | *{ 'MCE::Queue::insertp' } = \&_mce_m_insertp; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 37 | *{ 'MCE::Queue::peek' } = \&_mce_m_peek; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 37 | *{ 'MCE::Queue::peekp' } = \&_mce_m_peekp; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 37 | *{ 'MCE::Queue::peekh' } = \&_mce_m_peekh; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 37 | *{ 'MCE::Queue::heap' } = \&_mce_m_heap; | |||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 37 | return; | |||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 81 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 82 | ## Define constants & variables. | ||||||||||||||||||||||||||||||||||||||||||
| 83 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 84 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 37 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 37 | OUTPUT_W_QUE => 'W~QUE', # Await from the queue | |||||||||||||||||||||||||||||||||||||||||
| 88 | OUTPUT_C_QUE => 'C~QUE', # Clear the queue | ||||||||||||||||||||||||||||||||||||||||||
| 89 | OUTPUT_E_QUE => 'E~QUE', # End the queue | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | OUTPUT_A_QUE => 'A~QUE', # Enqueue into queue (array) | ||||||||||||||||||||||||||||||||||||||||||
| 92 | OUTPUT_A_QUP => 'A~QUP', # Enqueue into queue (array (p)) | ||||||||||||||||||||||||||||||||||||||||||
| 93 | OUTPUT_D_QUE => 'D~QUE', # Dequeue from queue (blocking) | ||||||||||||||||||||||||||||||||||||||||||
| 94 | OUTPUT_D_QUN => 'D~QUN', # Dequeue from queue (non-blocking) | ||||||||||||||||||||||||||||||||||||||||||
| 95 | OUTPUT_D_QUT => 'D~QUT', # Dequeue from queue (timed) | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | OUTPUT_N_QUE => 'N~QUE', # Return the number of items | ||||||||||||||||||||||||||||||||||||||||||
| 98 | OUTPUT_I_QUE => 'I~QUE', # Insert into queue | ||||||||||||||||||||||||||||||||||||||||||
| 99 | OUTPUT_I_QUP => 'I~QUP', # Insert into queue (p) | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | OUTPUT_P_QUE => 'P~QUE', # Peek into queue | ||||||||||||||||||||||||||||||||||||||||||
| 102 | OUTPUT_P_QUP => 'P~QUP', # Peek into queue (p) | ||||||||||||||||||||||||||||||||||||||||||
| 103 | OUTPUT_P_QUH => 'P~QUH', # Peek into heap | ||||||||||||||||||||||||||||||||||||||||||
| 104 | OUTPUT_H_QUE => 'H~QUE' # Return the heap | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 37 | }; | |||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | ## Attributes used internally. | ||||||||||||||||||||||||||||||||||||||||||
| 108 | ## _qr_sock _qw_sock _datp _datq _dsem _heap _id _init_pid _porder _type | ||||||||||||||||||||||||||||||||||||||||||
| 109 | ## _ar_sock _aw_sock _asem _tsem | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 37 | ▶ | my $_tid = $INC{'threads.pm'} ? threads->tid() : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 37 | my %_valid_fields_new = map { $_ => 1 } qw( | |||||||||||||||||||||||||||||||||||||||||
| 114 | await barrier fast gather porder queue type | ||||||||||||||||||||||||||||||||||||||||||
| 115 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 37 | my $_all = {}; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 37 | my $_qid = 0; | |||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub CLONE { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLONE: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | $_tid = threads->tid() if $INC{'threads.pm'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 23 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=5 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 23 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 23 | ▶ | my $_pid = $_tid ? $$ .'.'. $_tid : $$; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 23 | ▶ | delete $_all->{ $_Q->{_id} } if exists $_Q->{_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 23 | undef $_Q->{_datp}, undef $_Q->{_datq}, undef $_Q->{_heap}; | |||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 23 | ▶ | if (exists $_Q->{_init_pid} && $_Q->{_init_pid} eq $_pid) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $_Q->{"_init_pid"} and $_Q->{"_init_pid"} eq $_pid
MC/DC50%1/2
exists $_Q->{"_init_pid"} and $_Q->{"_init_pid"} eq $_pid
exists $_Q->{"_init_pid"}
$_Q->{"_init_pid"} eq $_pid
Truth table66%2/3
A and B
A= exists $_Q->{"_init_pid"}B= $_Q->{"_init_pid"} eq $_pid
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 16 | MCE::Util::_destroy_socks($_Q, qw(_aw_sock _ar_sock _qw_sock _qr_sock)); | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 23 | return; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 139 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 140 | ## New instance instantiation. | ||||||||||||||||||||||||||||||||||||||||||
| 141 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 142 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 51 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=16 SCAR=30.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 51 | my ($_class, %_argv) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 146 | 51 | my $_pkg = caller; | |||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 51 | @_ = (); | |||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 51 | ▶ | my $_Q = {}; bless($_Q, ref($_class) || $_class); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $_class || $_class
MC/DC0%0/2
ref $_class || $_class
ref $_class
$_class
Truth table33%1/3
A || B
A= ref $_classB= $_class
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 51 | for my $_p (keys %_argv) { | |||||||||||||||||||||||||||||||||||||||||
| 153 | _croak("Queue: ($_p) is not a valid constructor argument") | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 45 | ▶ | unless (exists $_valid_fields_new{$_p}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 51 | $_Q->{_asem} = 0; # Semaphore count variable for the ->await method | |||||||||||||||||||||||||||||||||||||||||
| 158 | 51 | $_Q->{_datp} = {}; # Priority data { p1 => [ ], p2 => [ ], pN => [ ] } | |||||||||||||||||||||||||||||||||||||||||
| 159 | 51 | $_Q->{_heap} = []; # Priority heap [ pN, p2, p1 ] in heap order | |||||||||||||||||||||||||||||||||||||||||
| 160 | # fyi, _datp will always dequeue before _datq | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | $_Q->{_await} = (defined $_argv{await}) | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 51 | ▶ | ? $_argv{await} : $_def->{$_pkg}{AWAIT} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$_def->{$_pkg}{"AWAIT"} or 0
MC/DC0%0/1
$_def->{$_pkg}{"AWAIT"} or 0
$_def->{$_pkg}{"AWAIT"}
Truth table50%1/2
A
A= $_def->{$_pkg}{"AWAIT"}
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | $_Q->{_porder} = (defined $_argv{porder}) | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 51 | ▶ | ? $_argv{porder} : $_def->{$_pkg}{PORDER} || $HIGHEST; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_def->{$_pkg}{"PORDER"} or $MCE::Queue::HIGHEST
MC/DC0%0/2
$_def->{$_pkg}{"PORDER"} or $MCE::Queue::HIGHEST
$_def->{$_pkg}{"PORDER"}
$MCE::Queue::HIGHEST
Truth table33%1/3
A or B
A= $_def->{$_pkg}{"PORDER"}B= $MCE::Queue::HIGHEST
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | $_Q->{_type} = (defined $_argv{type}) | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 51 | ▶ | ? $_argv{type} : $_def->{$_pkg}{TYPE} || $FIFO; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_def->{$_pkg}{"TYPE"} or $MCE::Queue::FIFO
MC/DC0%0/2
$_def->{$_pkg}{"TYPE"} or $MCE::Queue::FIFO
$_def->{$_pkg}{"TYPE"}
$MCE::Queue::FIFO
Truth table33%1/3
A or B
A= $_def->{$_pkg}{"TYPE"}B= $MCE::Queue::FIFO
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 51 | ▶ | if (exists $_argv{queue}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | _croak('Queue: (queue) is not an ARRAY reference') | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 7 | ▶ | unless (ref $_argv{queue} eq 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 7 | $_Q->{_datq} = $_argv{queue}; | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 44 | $_Q->{_datq} = []; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 51 | ▶ | if (exists $_argv{gather}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | _croak('Queue: (gather) is not a CODE reference') | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | unless (ref $_argv{gather} eq 'CODE'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $_Q->{gather} = $_argv{gather}; | |||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 51 | $_Q->{_qr_mutex} = MCE::Mutex->new(); | |||||||||||||||||||||||||||||||||||||||||
| 193 | 51 | ▶ | $_Q->{_init_pid} = $_tid ? $$ .'.'. $_tid : $$; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 51 | $_Q->{_id} = ++$_qid; $_all->{$_qid} = $_Q; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 51 | $_Q->{_dsem} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 51 | MCE::Util::_sock_pair($_Q, qw(_qr_sock _qw_sock), undef, 1); | |||||||||||||||||||||||||||||||||||||||||
| 198 | 51 | ▶ | MCE::Util::_sock_pair($_Q, qw(_ar_sock _aw_sock), undef, 1) if $_Q->{_await}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 51 | return $_Q; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 204 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 205 | ## Private methods. | ||||||||||||||||||||||||||||||||||||||||||
| 206 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 207 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub _croak { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_croak: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | unless ($INC{'MCE.pm'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $\ = undef; require Carp; goto &Carp::croak; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | goto &MCE::_croak; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | ## Add items to the tail of the queue with priority level. | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 83 | ▶ | sub _enqueuep { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_enqueuep: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 83 | my ($_Q, $_p) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | ## Enlist priority into the heap. | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 83 | ▶ | if (!exists $_Q->{_datp}->{$_p} || @{ $_Q->{_datp}->{$_p} } == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not exists $_Q->{"_datp"}{$_p} or @{$_Q->{"_datp"}{$_p};} == 0
MC/DC100%2/2
not exists $_Q->{"_datp"}{$_p} or @{$_Q->{"_datp"}{$_p};} == 0
not exists $_Q->{"_datp"}{$_p}
@{$_Q->{"_datp"}{$_p};} == 0
Truth table100%3/3
not(A) or B
A= not exists $_Q->{"_datp"}{$_p}B= @{$_Q->{"_datp"}{$_p};} == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 65 | ▶ | unless (scalar @{ $_Q->{_heap} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 50 | push @{ $_Q->{_heap} }, $_p; | |||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | elsif ($_Q->{_porder}) { | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 9 | $_Q->_heap_insert_high($_p); | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 6 | $_Q->_heap_insert_low($_p); | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | ## Append item(s) into the queue. | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 83 | push @{ $_Q->{_datp}->{$_p} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 83 | return; | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | ## Return one item from the queue. | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 952 | ▶ | sub _dequeue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dequeue: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 952 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | ## Return item from the non-priority queue. | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 952 | ▶ | unless (scalar @{ $_Q->{_heap} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | return ($_Q->{_type}) | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 858 | ▶ | ? shift @{ $_Q->{_datq} } : pop @{ $_Q->{_datq} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 94 | my $_p = $_Q->{_heap}->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | ## Delist priority from the heap when 1 item remains. | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 94 | ▶ | shift @{ $_Q->{_heap} } if (@{ $_Q->{_datp}->{$_p} } == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | ## Return item from the priority queue. | ||||||||||||||||||||||||||||||||||||||||||
| 259 | return ($_Q->{_type}) | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 94 | ▶ | ? shift @{ $_Q->{_datp}->{$_p} } : pop @{ $_Q->{_datp}->{$_p} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | ## Helper method for getting the reference to the underlying array. | ||||||||||||||||||||||||||||||||||||||||||
| 264 | ## Use with test scripts for comparing data only (not a public API). | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 50 | ▶ | sub _get_aref { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_aref: called CC=9 SCAR=23.4
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 50 | my ($_Q, $_p) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 50 | ▶ | return if ($INC{'MCE.pm'} && !defined $MCE::MCE->{_wid}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$INC{"MCE.pm"} and not defined $MCE::MCE->{"_wid"}
MC/DC0%0/2
$INC{"MCE.pm"} and not defined $MCE::MCE->{"_wid"}
$INC{"MCE.pm"}
not defined $MCE::MCE->{"_wid"}
Truth table66%2/3
A and not(B)
A= $INC{"MCE.pm"}B= not defined $MCE::MCE->{"_wid"}
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 50 | ▶ | return if (defined $MCE::MCE && $MCE::MCE->{_wid}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $MCE::MCE and $MCE::MCE->{"_wid"}
MC/DC0%0/2
defined $MCE::MCE and $MCE::MCE->{"_wid"}
defined $MCE::MCE
$MCE::MCE->{"_wid"}
Truth table66%2/3
A and B
A= defined $MCE::MCEB= $MCE::MCE->{"_wid"}
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 50 | ▶ | if (defined $_p) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 45 | ▶ | _croak('Queue: (get_aref priority) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_p) or int $_p != $_p
MC/DC0%0/2
not &looks_like_number($_p) or int $_p != $_p
not &looks_like_number($_p)
int $_p != $_p
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_p)B= int $_p != $_p
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | if (!looks_like_number($_p) || int($_p) != $_p); | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 45 | ▶ | return undef unless (exists $_Q->{_datp}->{$_p}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 36 | return $_Q->{_datp}->{$_p}; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 5 | return $_Q->{_datq}; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | ## Insert priority into the heap. A lower priority level comes first. | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 6 | ▶ | sub _heap_insert_low { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_heap_insert_low: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 6 | my ($_Q, $_p) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | ## Insert priority at the head of the heap. | ||||||||||||||||||||||||||||||||||||||||||
| 289 | 6 | ▶ | if ($_p < $_Q->{_heap}->[0]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | unshift @{ $_Q->{_heap} }, $_p; | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | ## Insert priority at the end of the heap. | ||||||||||||||||||||||||||||||||||||||||||
| 294 | elsif ($_p > $_Q->{_heap}->[-1]) { | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 4 | push @{ $_Q->{_heap} }, $_p; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | ## Insert priority through binary search. | ||||||||||||||||||||||||||||||||||||||||||
| 299 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 2 | my $_lower = 0; my $_upper = @{ $_Q->{_heap} }; | |||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 2 | ▶ | while ($_lower < $_upper) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 4 | my $_midpoint = $_lower + (($_upper - $_lower) >> 1); | |||||||||||||||||||||||||||||||||||||||||
| 304 | 4 | ▶ | if ($_p > $_Q->{_heap}->[$_midpoint]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 2 | $_lower = $_midpoint + 1; | |||||||||||||||||||||||||||||||||||||||||
| 306 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 2 | $_upper = $_midpoint; | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | ## Insert priority into the heap. | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 2 | splice @{ $_Q->{_heap} }, $_lower, 0, $_p; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | ## Insert priority into the heap. A higher priority level comes first. | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 9 | ▶ | sub _heap_insert_high { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_heap_insert_high: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 9 | my ($_Q, $_p) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | ## Insert priority at the head of the heap. | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 9 | ▶ | if ($_p > $_Q->{_heap}->[0]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 6 | unshift @{ $_Q->{_heap} }, $_p; | |||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | ## Insert priority at the end of the heap. | ||||||||||||||||||||||||||||||||||||||||||
| 329 | elsif ($_p < $_Q->{_heap}->[-1]) { | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | push @{ $_Q->{_heap} }, $_p; | |||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | ## Insert priority through binary search. | ||||||||||||||||||||||||||||||||||||||||||
| 334 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 3 | my $_lower = 0; my $_upper = @{ $_Q->{_heap} }; | |||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 3 | ▶ | while ($_lower < $_upper) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 6 | my $_midpoint = $_lower + (($_upper - $_lower) >> 1); | |||||||||||||||||||||||||||||||||||||||||
| 339 | 6 | ▶ | if ($_p < $_Q->{_heap}->[$_midpoint]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 3 | $_lower = $_midpoint + 1; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 3 | $_upper = $_midpoint; | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | ## Insert priority into the heap. | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 3 | splice @{ $_Q->{_heap} }, $_lower, 0, $_p; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 9 | return; | |||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 354 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 355 | ## Output routines for the manager process. | ||||||||||||||||||||||||||||||||||||||||||
| 356 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 357 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | { | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 37 | my ($_MCE, $_DAU_R_SOCK_REF, $_DAU_R_SOCK, $_cnt, $_i, $_id); | |||||||||||||||||||||||||||||||||||||||||
| 361 | 37 | my ($_len, $_p, $_t, $_Q, $_has_data, $_pending); | |||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | my %_output_function = ( | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | OUTPUT_W_QUE.$LF => sub { # Await from the queue | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 369 | chomp($_t = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $_Q->{_tsem} = $_t; | |||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | if ($_Q->pending() <= $_t) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | syswrite($_Q->{_aw_sock}, $LF); | |||||||||||||||||||||||||||||||||||||||||
| 376 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $_Q->{_asem} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | print {$_DAU_R_SOCK} $LF; | |||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 383 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 20 | ▶ | OUTPUT_C_QUE.$LF => sub { # Clear the queue | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 20 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 20 | chomp($_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 389 | 20 | _mce_m_clear($_all->{$_id}); | |||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | 20 | print {$_DAU_R_SOCK} $LF; | |||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||
| 394 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | OUTPUT_E_QUE.$LF => sub { # End the queue | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | chomp($_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | _mce_m_end($_all->{$_id}); | |||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | print {$_DAU_R_SOCK} $LF; | |||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 405 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 105 | ▶ | OUTPUT_A_QUE.$LF => sub { # Enqueue into queue (A) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 105 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 105 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 413 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 105 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | 105 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 105 | ▶ | if ($_Q->{gather}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | local $_ = $_MCE->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $_Q->{gather}($_Q, @{ $_ }); | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 424 | 105 | $_Q->_mce_m_enqueue(@{ $_MCE->{thaw}($_buf) }); | |||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 105 | return; | |||||||||||||||||||||||||||||||||||||||||
| 428 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | 54 | ▶ | OUTPUT_A_QUP.$LF => sub { # Enqueue into queue (A,p) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 54 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | 54 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 434 | chomp($_p = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||
| 435 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 54 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 54 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 440 | 54 | $_Q->_mce_m_enqueuep($_p, @{ $_MCE->{thaw}($_buf) }); | |||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 54 | return; | |||||||||||||||||||||||||||||||||||||||||
| 443 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | 849 | ▶ | OUTPUT_D_QUE.$LF => sub { # Dequeue from queue (B) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=17 SCAR=29.0
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 849 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | 849 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 451 | chomp($_cnt = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 849 | ▶ | $_cnt = 0 if ($_cnt == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 849 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | 849 | my (@_items, $_buf); | |||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | 849 | ▶ | if ($_cnt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 13 | my $_pending = @{ $_Q->{_datq} }; | |||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | 13 | ▶ | if ($_pending < $_cnt && scalar @{ $_Q->{_heap} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
MC/DC100%1/1
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
$_pending < $_cnt
Truth table100%2/2
A
A= $_pending < $_cnt
| |||||||||||||||||||||||||||||||||||||||||||
| 462 | 10 | for my $_h (@{ $_Q->{_heap} }) { | |||||||||||||||||||||||||||||||||||||||||
| 463 | 19 | $_pending += @{ $_Q->{_datp}->{$_h} }; | |||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | 13 | ▶ | $_cnt = $_pending if $_pending < $_cnt; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 13 | for my $_i (1 .. $_cnt) { push @_items, $_Q->_dequeue() } | |||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 471 | 836 | ▶ | $_has_data = ( @{ $_Q->{_datq} } || @{ $_Q->{_heap} } ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@{$_Q->{"_datq"};} or @{$_Q->{"_heap"};}
MC/DC100%2/2
@{$_Q->{"_datq"};} or @{$_Q->{"_heap"};}
@{$_Q->{"_datq"};}
@{$_Q->{"_heap"};}
Truth table100%3/3
A or B
A= @{$_Q->{"_datq"};}B= @{$_Q->{"_heap"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | 836 | $_buf = $_Q->_dequeue(); | |||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 849 | ▶ | if ($_cnt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | 13 | $_buf = $_MCE->{freeze}(\@_items); | |||||||||||||||||||||||||||||||||||||||||
| 477 | 13 | print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | elsif ($_has_data) { | ||||||||||||||||||||||||||||||||||||||||||
| 480 | 628 | $_buf = $_MCE->{freeze}([ $_buf ]); | |||||||||||||||||||||||||||||||||||||||||
| 481 | 628 | print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | elsif (exists $_Q->{_ended}) { | ||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | print {$_DAU_R_SOCK} '-2'.$LF; | |||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||
| 486 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 487 | 208 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||
| 488 | 208 | $_Q->{_dsem} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | 849 | ▶ | if ($_Q->{_await} && $_Q->{_asem} && $_Q->pending() <= $_Q->{_tsem}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$_Q->{"_await"} and $_Q->{"_asem"} and $_Q->pending <= $_Q->{"_tsem"}
$_Q->{"_await"} and $_Q->{"_asem"}
MC/DC0%0/3
$_Q->{"_await"} and $_Q->{"_asem"} and $_Q->pending <= $_Q->{"_tsem"}
$_Q->{"_await"}
$_Q->{"_asem"}
$_Q->pending <= $_Q->{"_tsem"}
Truth table50%2/4
A and B and C
A= $_Q->{"_await"}B= $_Q->{"_asem"}C= $_Q->pending <= $_Q->{"_tsem"}
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | for my $_i (1 .. $_Q->{_asem}) { | |||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | syswrite($_Q->{_aw_sock}, $LF); | |||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $_Q->{_asem} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | 849 | return; | |||||||||||||||||||||||||||||||||||||||||
| 499 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 20 | ▶ | OUTPUT_D_QUN.$LF => sub { # Dequeue from queue (NB) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=42.3
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | 20 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||
| 504 | 20 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 505 | chomp($_cnt = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | 20 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | 20 | ▶ | if ($_cnt == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 510 | 20 | my $_buf = $_Q->_dequeue(); | |||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | 20 | ▶ | if (defined $_buf) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 20 | $_buf = $_MCE->{freeze}([ $_buf ]); | |||||||||||||||||||||||||||||||||||||||||
| 514 | 20 | print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||
| 516 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | my @_items; | |||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | my $_pending = @{ $_Q->{_datq} }; | |||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | if ($_pending < $_cnt && scalar @{ $_Q->{_heap} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
MC/DC0%0/1
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
$_pending < $_cnt
Truth table0%0/2
A
A= $_pending < $_cnt
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | for my $_h (@{ $_Q->{_heap} }) { | |||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | $_pending += @{ $_Q->{_datp}->{$_h} }; | |||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | $_cnt = $_pending if $_pending < $_cnt; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | for my $_i (1 .. $_cnt) { push @_items, $_Q->_dequeue() } | |||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | if ($_cnt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | my $_buf = $_MCE->{freeze}(\@_items); | |||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 537 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||
| 542 | 20 | ▶ | if ($_Q->{_await} && $_Q->{_asem} && $_Q->pending() <= $_Q->{_tsem}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$_Q->{"_await"} and $_Q->{"_asem"} and $_Q->pending <= $_Q->{"_tsem"}
$_Q->{"_await"} and $_Q->{"_asem"}
MC/DC0%0/3
$_Q->{"_await"} and $_Q->{"_asem"} and $_Q->pending <= $_Q->{"_tsem"}
$_Q->{"_await"}
$_Q->{"_asem"}
$_Q->pending <= $_Q->{"_tsem"}
Truth table25%1/4
A and B and C
A= $_Q->{"_await"}B= $_Q->{"_asem"}C= $_Q->pending <= $_Q->{"_tsem"}
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | for my $_i (1 .. $_Q->{_asem}) { | |||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | syswrite($_Q->{_aw_sock}, $LF); | |||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $_Q->{_asem} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||
| 550 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | OUTPUT_D_QUT.$LF => sub { # Dequeue from queue (Timed) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | chomp($_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | $_Q->{_dsem} -= 1 if $_Q->{_dsem}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | print {$_DAU_R_SOCK} $LF; | |||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 563 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | 10 | ▶ | OUTPUT_N_QUE.$LF => sub { # Return number of items | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 10 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | 10 | chomp($_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||
| 572 | 10 | print {$_DAU_R_SOCK} $_all->{$_id}->_mce_m_pending().$LF; | |||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||
| 574 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||
| 575 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | 30 | ▶ | OUTPUT_I_QUE.$LF => sub { # Insert into queue | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | 30 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | 30 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 581 | chomp($_i = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||
| 582 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | 30 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | 30 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 587 | 30 | $_Q->_mce_m_insert($_i, @{ $_MCE->{thaw}($_buf) }); | |||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | 30 | return; | |||||||||||||||||||||||||||||||||||||||||
| 590 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 70 | ▶ | OUTPUT_I_QUP.$LF => sub { # Insert into queue (p) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | 70 | $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | 70 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 596 | chomp($_p = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||
| 597 | chomp($_i = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||
| 598 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||
| 600 | 70 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | 70 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 603 | 70 | $_Q->_mce_m_insertp($_p, $_i, @{ $_MCE->{thaw}($_buf) }); | |||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||
| 605 | 70 | return; | |||||||||||||||||||||||||||||||||||||||||
| 606 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||
| 610 | 33 | ▶ | OUTPUT_P_QUE.$LF => sub { # Peek into queue | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 33 | my $_buf; $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||
| 613 | 33 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 614 | chomp($_i = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 33 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 617 | 33 | $_buf = $_Q->_mce_m_peek($_i); | |||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | 33 | ▶ | if (defined $_buf) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | 24 | $_buf = $_MCE->{freeze}([ $_buf ]); | |||||||||||||||||||||||||||||||||||||||||
| 621 | 24 | print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||
| 622 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 623 | 9 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | 33 | return; | |||||||||||||||||||||||||||||||||||||||||
| 627 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | 77 | ▶ | OUTPUT_P_QUP.$LF => sub { # Peek into queue (p) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 630 | 77 | my $_buf; $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | 77 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 633 | chomp($_p = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||
| 634 | chomp($_i = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | 77 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 637 | 77 | $_buf = $_Q->_mce_m_peekp($_p, $_i); | |||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||
| 639 | 77 | ▶ | if (defined $_buf) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | 56 | $_buf = $_MCE->{freeze}([ $_buf ]); | |||||||||||||||||||||||||||||||||||||||||
| 641 | 56 | print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||
| 642 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 643 | 21 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||
| 646 | 77 | return; | |||||||||||||||||||||||||||||||||||||||||
| 647 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | 6 | ▶ | OUTPUT_P_QUH.$LF => sub { # Peek into heap | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 650 | 6 | my $_buf; $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||
| 652 | 6 | chomp($_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||
| 653 | chomp($_i = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | 6 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 656 | 6 | $_buf = $_Q->_mce_m_peekh($_i); | |||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | 6 | ▶ | if (defined $_buf) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 659 | 6 | $_buf = $_MCE->{freeze}([ $_buf ]); | |||||||||||||||||||||||||||||||||||||||||
| 660 | 6 | print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||
| 661 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||
| 665 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||
| 666 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||
| 668 | 3 | ▶ | OUTPUT_H_QUE.$LF => sub { # Return the heap | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 669 | 3 | my $_buf; $_DAU_R_SOCK = ${ $_DAU_R_SOCK_REF }; | |||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | 3 | chomp($_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | 3 | $_Q = $_all->{$_id}; | |||||||||||||||||||||||||||||||||||||||||
| 674 | 3 | $_buf = $_MCE->{freeze}([ $_Q->_mce_m_heap() ]); | |||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | 3 | print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 679 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 37 | ); | |||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 87 | ▶ | sub _mce_m_loop_begin { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_loop_begin: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | 87 | ($_MCE, $_DAU_R_SOCK_REF) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||
| 688 | 87 | return; | |||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | 87 | ▶ | sub _mce_m_loop_end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_loop_end: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 692 | 87 | $_MCE = $_DAU_R_SOCK_REF = $_DAU_R_SOCK = $_cnt = $_i = $_id = | |||||||||||||||||||||||||||||||||||||||||
| 693 | $_len = $_p = $_Q = undef; | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | 87 | return; | |||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||
| 698 | 35 | ▶ | sub _mce_m_init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_init: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 699 | 35 | MCE::_attach_plugin( | |||||||||||||||||||||||||||||||||||||||||
| 700 | \%_output_function, \&_mce_m_loop_begin, \&_mce_m_loop_end, | ||||||||||||||||||||||||||||||||||||||||||
| 701 | \&_mce_w_init | ||||||||||||||||||||||||||||||||||||||||||
| 702 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | 35 | return; | |||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 710 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 711 | ## Methods for the manager process. | ||||||||||||||||||||||||||||||||||||||||||
| 712 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 713 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | ## await ( pending_threshold ) | ||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | 37 | ▶ | sub _mce_m_await { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_await: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 718 | # Handled by the manager process when called by MCE workers. | ||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | ## clear ( ) | ||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||
| 724 | 28 | ▶ | sub _mce_m_clear { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_clear: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 725 | 28 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | 28 | %{ $_Q->{_datp} } = (); | |||||||||||||||||||||||||||||||||||||||||
| 728 | 28 | @{ $_Q->{_datq} } = (); | |||||||||||||||||||||||||||||||||||||||||
| 729 | 28 | @{ $_Q->{_heap} } = (); | |||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | 28 | return; | |||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||
| 734 | ## end ( ) | ||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | ▶ | sub _mce_m_end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_end: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | if (!exists $_Q->{_ended}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | for my $_i (1 .. $_Q->{_dsem}) { syswrite($_Q->{_qw_sock}, $LF) } | |||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | $_Q->{_dsem} = 0, $_Q->{_ended} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | ## enqueue ( item [, item, ... ] ) | ||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||
| 749 | 569 | ▶ | sub _mce_m_enqueue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_enqueue: called CC=6 SCAR=18.4
| |||||||||||||||||||||||||||||||||||||||||||
| 750 | 569 | my $_Q = shift; | |||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||
| 752 | 569 | ▶ | return unless (scalar @_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | 569 | ▶ | if (exists $_Q->{_ended}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | warn "Queue: (enqueue) called on queue that has been 'end'ed\n"; | |||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||
| 759 | 569 | ▶ | if ($_Q->{_dsem}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 760 | 181 | for my $_i (1 .. scalar @_) { | |||||||||||||||||||||||||||||||||||||||||
| 761 | 208 | $_Q->{_dsem} -= 1, syswrite($_Q->{_qw_sock}, $LF); | |||||||||||||||||||||||||||||||||||||||||
| 762 | 208 | ▶ | last unless $_Q->{_dsem}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||
| 766 | ## Append item(s) into the queue. | ||||||||||||||||||||||||||||||||||||||||||
| 767 | 569 | push @{ $_Q->{_datq} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | 569 | return; | |||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||
| 772 | ## enqueuep ( priority, item [, item, ... ] ) | ||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||
| 774 | 74 | ▶ | sub _mce_m_enqueuep { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_enqueuep: called CC=8 SCAR=28.3
| |||||||||||||||||||||||||||||||||||||||||||
| 775 | 74 | my ($_Q, $_p) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||
| 777 | 74 | ▶ | _croak('Queue: (enqueuep priority) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_p) or int $_p != $_p
MC/DC0%0/2
not &looks_like_number($_p) or int $_p != $_p
not &looks_like_number($_p)
int $_p != $_p
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_p)B= int $_p != $_p
| |||||||||||||||||||||||||||||||||||||||||||
| 778 | if (!looks_like_number($_p) || int($_p) != $_p); | ||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||
| 780 | 74 | ▶ | return unless (scalar @_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||
| 782 | 74 | ▶ | if (exists $_Q->{_ended}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | warn "Queue: (enqueuep) called on queue that has been 'end'ed\n"; | |||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | 74 | ▶ | if ($_Q->{_dsem}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | for my $_i (1 .. scalar @_) { | |||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | $_Q->{_dsem} -= 1, syswrite($_Q->{_qw_sock}, $LF); | |||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | ▶ | last unless $_Q->{_dsem}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 791 | } | ||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||
| 794 | 74 | $_Q->_enqueuep($_p, @_); | |||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | 74 | return; | |||||||||||||||||||||||||||||||||||||||||
| 797 | } | ||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||
| 799 | ## dequeue ( ) | ||||||||||||||||||||||||||||||||||||||||||
| 800 | ## dequeue ( count ) | ||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||
| 802 | 16 | ▶ | sub _mce_m_dequeue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_dequeue: called CC=16 SCAR=30.2
| |||||||||||||||||||||||||||||||||||||||||||
| 803 | 16 | my ($_Q, $_cnt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 804 | 16 | my (@_items, $_has_data, $_buf); | |||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||
| 806 | 16 | ▶ | if (defined $_cnt && $_cnt ne '1') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $_cnt and $_cnt ne 1
MC/DC100%2/2
defined $_cnt and $_cnt ne 1
defined $_cnt
$_cnt ne 1
Truth table100%3/3
A and B
A= defined $_cntB= $_cnt ne 1
| |||||||||||||||||||||||||||||||||||||||||||
| 807 | 6 | ▶ | _croak('Queue: (dequeue count argument) is not valid') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt) or int $_cnt != $_cnt
MC/DC0%0/3
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt)
int $_cnt != $_cnt
$_cnt < 1
Truth table25%1/4
not(A) or B or C
A= not &looks_like_number($_cnt)B= int $_cnt != $_cntC= $_cnt < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 808 | if (!looks_like_number($_cnt) || int($_cnt) != $_cnt || $_cnt < 1); | ||||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||
| 810 | 6 | my $_pending = @{ $_Q->{_datq} }; | |||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||
| 812 | 6 | ▶ | if ($_pending < $_cnt && scalar @{ $_Q->{_heap} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
MC/DC100%1/1
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
$_pending < $_cnt
Truth table100%2/2
A
A= $_pending < $_cnt
| |||||||||||||||||||||||||||||||||||||||||||
| 813 | 4 | for my $_h (@{ $_Q->{_heap} }) { | |||||||||||||||||||||||||||||||||||||||||
| 814 | 10 | $_pending += @{ $_Q->{_datp}->{$_h} }; | |||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||
| 817 | 6 | ▶ | $_cnt = $_pending if $_pending < $_cnt; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||
| 819 | 6 | for my $_i (1 .. $_cnt) { push @_items, $_Q->_dequeue() } | |||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||
| 821 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 822 | 10 | ▶ | $_has_data = ( @{ $_Q->{_datq} } || @{ $_Q->{_heap} } ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@{$_Q->{"_datq"};} or @{$_Q->{"_heap"};}
MC/DC0%0/2
@{$_Q->{"_datq"};} or @{$_Q->{"_heap"};}
@{$_Q->{"_datq"};}
@{$_Q->{"_heap"};}
Truth table66%2/3
A or B
A= @{$_Q->{"_datq"};}B= @{$_Q->{"_heap"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 823 | 10 | $_buf = $_Q->_dequeue(); | |||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | 16 | ▶ | return @_items if (scalar @_items); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 827 | 10 | ▶ | return $_buf if ($_has_data); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | ▶ | return () if (exists $_Q->{_ended}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | $_Q->{_dsem} += 1, MCE::Util::_sysread($_Q->{_qr_sock}, my($_next), 1); | |||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | goto \&_mce_m_dequeue; | |||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||
| 835 | ## dequeue_nb ( ) | ||||||||||||||||||||||||||||||||||||||||||
| 836 | ## dequeue_nb ( count ) | ||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||
| 838 | 4 | ▶ | sub _mce_m_dequeue_nb { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_dequeue_nb: called CC=11 SCAR=43.2
| |||||||||||||||||||||||||||||||||||||||||||
| 839 | 4 | my ($_Q, $_cnt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||
| 841 | 4 | ▶ | if (defined $_cnt && $_cnt ne '1') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_cnt and $_cnt ne 1
MC/DC0%0/2
defined $_cnt and $_cnt ne 1
defined $_cnt
$_cnt ne 1
Truth table33%1/3
A and B
A= defined $_cntB= $_cnt ne 1
| |||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | ▶ | _croak('Queue: (dequeue_nb count argument) is not valid') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt) or int $_cnt != $_cnt
MC/DC0%0/3
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt)
int $_cnt != $_cnt
$_cnt < 1
Truth table0%0/4
not(A) or B or C
A= not &looks_like_number($_cnt)B= int $_cnt != $_cntC= $_cnt < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 843 | if (!looks_like_number($_cnt) || int($_cnt) != $_cnt || $_cnt < 1); | ||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | my $_pending = @{ $_Q->{_datq} }; | |||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | ▶ | if ($_pending < $_cnt && scalar @{ $_Q->{_heap} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
MC/DC0%0/1
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
$_pending < $_cnt
Truth table0%0/2
A
A= $_pending < $_cnt
| |||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | for my $_h (@{ $_Q->{_heap} }) { | |||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | $_pending += @{ $_Q->{_datp}->{$_h} }; | |||||||||||||||||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | ▶ | $_cnt = $_pending if $_pending < $_cnt; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | return map { $_Q->_dequeue() } 1 .. $_cnt; | |||||||||||||||||||||||||||||||||||||||||
| 856 | } | ||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||
| 858 | 4 | my $_buf = $_Q->_dequeue(); | |||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||
| 860 | 4 | ▶ | return defined($_buf) ? $_buf : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||
| 863 | ## dequeue_timed ( timeout ) | ||||||||||||||||||||||||||||||||||||||||||
| 864 | ## dequeue_timed ( timeout, count ) | ||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | 4 | ▶ | sub _mce_m_dequeue_timed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_dequeue_timed: called CC=13 SCAR=45.7
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | 4 | my ($_Q, $_timeout, $_cnt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||
| 869 | 4 | ▶ | if (defined $_timeout) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | _croak('Queue: (dequeue_timed timeout argument) is not valid') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 871 | if (!looks_like_number($_timeout)); | ||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||
| 874 | 4 | ▶ | if (defined $_cnt && $_cnt ne '1') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_cnt and $_cnt ne 1
MC/DC0%0/2
defined $_cnt and $_cnt ne 1
defined $_cnt
$_cnt ne 1
Truth table33%1/3
A and B
A= defined $_cntB= $_cnt ne 1
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | ▶ | _croak('Queue: (dequeue_timed count argument) is not valid') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt) or int $_cnt != $_cnt
MC/DC0%0/3
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt)
int $_cnt != $_cnt
$_cnt < 1
Truth table0%0/4
not(A) or B or C
A= not &looks_like_number($_cnt)B= int $_cnt != $_cntC= $_cnt < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 876 | if (!looks_like_number($_cnt) || int($_cnt) != $_cnt || $_cnt < 1); | ||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | my $_pending = @{ $_Q->{_datq} }; | |||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | if ($_pending < $_cnt && scalar @{ $_Q->{_heap} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
MC/DC0%0/1
$_pending < $_cnt and scalar @{$_Q->{"_heap"};}
$_pending < $_cnt
Truth table0%0/2
A
A= $_pending < $_cnt
| |||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | for my $_h (@{ $_Q->{_heap} }) { | |||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | $_pending += @{ $_Q->{_datp}->{$_h} }; | |||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | $_cnt = $_pending if $_pending < $_cnt; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | return map { $_Q->_dequeue() } 1 .. $_cnt; | |||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||
| 891 | 4 | my $_buf = $_Q->_dequeue(); | |||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | 4 | ▶ | return defined($_buf) ? $_buf : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||
| 896 | ## pending ( ) | ||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||
| 898 | 14 | ▶ | sub _mce_m_pending { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_pending: called CC=5 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||
| 899 | 14 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 900 | 14 | my $_pending = @{ $_Q->{_datq} }; | |||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||
| 902 | 14 | ▶ | if (scalar @{ $_Q->{_heap} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 903 | 9 | for my $_h (@{ $_Q->{_heap} }) { | |||||||||||||||||||||||||||||||||||||||||
| 904 | 9 | $_pending += @{ $_Q->{_datp}->{$_h} }; | |||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||
| 908 | return (exists $_Q->{_ended}) | ||||||||||||||||||||||||||||||||||||||||||
| 909 | 14 | ▶ | ? $_pending ? $_pending : undef | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 910 | : $_pending; | ||||||||||||||||||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||
| 913 | ## insert ( index, item [, item, ... ] ) | ||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||
| 915 | 50 | ▶ | sub _mce_m_insert { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_insert: called CC=14 SCAR=28.2
| |||||||||||||||||||||||||||||||||||||||||||
| 916 | 50 | my ($_Q, $_i) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||
| 918 | 50 | ▶ | _croak('Queue: (insert index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 919 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||
| 921 | 50 | ▶ | return unless (scalar @_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||
| 923 | 50 | ▶ | if (exists $_Q->{_ended}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | warn "Queue: (insert) called on queue that has been 'end'ed\n"; | |||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||
| 928 | 50 | ▶ | if ($_Q->{_dsem}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | for my $_i (1 .. scalar @_) { | |||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | $_Q->{_dsem} -= 1, syswrite($_Q->{_qw_sock}, $LF); | |||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | ▶ | last unless $_Q->{_dsem}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||
| 935 | 50 | ▶ | if (abs($_i) > scalar @{ $_Q->{_datq} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 936 | 10 | ▶ | if ($_i >= 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 937 | 5 | ▶ | if ($_Q->{_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 938 | 3 | push @{ $_Q->{_datq} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 939 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 940 | 2 | unshift @{ $_Q->{_datq} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||
| 943 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 944 | 5 | ▶ | if ($_Q->{_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 945 | 3 | unshift @{ $_Q->{_datq} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 946 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 947 | 2 | push @{ $_Q->{_datq} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||
| 951 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 952 | 40 | ▶ | if (!$_Q->{_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 953 | $_i = ($_i >= 0) | ||||||||||||||||||||||||||||||||||||||||||
| 954 | 16 | ▶ | ? scalar(@{ $_Q->{_datq} }) - $_i | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 955 | : abs($_i); | ||||||||||||||||||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||||||||||||||||
| 957 | 40 | splice @{ $_Q->{_datq} }, $_i, 0, @_; | |||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||
| 960 | 50 | return; | |||||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||
| 963 | ## insertp ( priority, index, item [, item, ... ] ) | ||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||
| 965 | 90 | ▶ | sub _mce_m_insertp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_insertp: called CC=18 SCAR=31.5
| |||||||||||||||||||||||||||||||||||||||||||
| 966 | 90 | my ($_Q, $_p, $_i) = (shift, shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||
| 968 | 90 | ▶ | _croak('Queue: (insertp priority) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_p) or int $_p != $_p
MC/DC0%0/2
not &looks_like_number($_p) or int $_p != $_p
not &looks_like_number($_p)
int $_p != $_p
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_p)B= int $_p != $_p
| |||||||||||||||||||||||||||||||||||||||||||
| 969 | if (!looks_like_number($_p) || int($_p) != $_p); | ||||||||||||||||||||||||||||||||||||||||||
| 970 | 90 | ▶ | _croak('Queue: (insertp index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 971 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||
| 973 | 90 | ▶ | return unless (scalar @_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||
| 975 | 90 | ▶ | if (exists $_Q->{_ended}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | warn "Queue: (insertp) called on queue that has been 'end'ed\n"; | |||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||
| 980 | 90 | ▶ | if ($_Q->{_dsem}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | for my $_i (1 .. scalar @_) { | |||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | $_Q->{_dsem} -= 1, syswrite($_Q->{_qw_sock}, $LF); | |||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | ▶ | last unless $_Q->{_dsem}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||||||||||||||||
| 985 | } | ||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||
| 987 | 90 | ▶ | if (exists $_Q->{_datp}->{$_p} && scalar @{ $_Q->{_datp}->{$_p} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
exists $_Q->{"_datp"}{$_p} and scalar @{$_Q->{"_datp"}{$_p};}
MC/DC0%0/1
exists $_Q->{"_datp"}{$_p} and scalar @{$_Q->{"_datp"}{$_p};}
exists $_Q->{"_datp"}{$_p}
Truth table50%1/2
A
A= exists $_Q->{"_datp"}{$_p}
| |||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||
| 989 | 81 | ▶ | if (abs($_i) > scalar @{ $_Q->{_datp}->{$_p} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 990 | 18 | ▶ | if ($_i >= 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 991 | 9 | ▶ | if ($_Q->{_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 992 | 5 | push @{ $_Q->{_datp}->{$_p} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 993 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 994 | 4 | unshift @{ $_Q->{_datp}->{$_p} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||
| 997 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 998 | 9 | ▶ | if ($_Q->{_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 999 | 5 | unshift @{ $_Q->{_datp}->{$_p} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 1000 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | 4 | push @{ $_Q->{_datp}->{$_p} }, @_; | |||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | 63 | ▶ | if (!$_Q->{_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1007 | $_i = ($_i >=0) | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | 28 | ▶ | ? scalar(@{ $_Q->{_datp}->{$_p} }) - $_i | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1009 | : abs($_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1010 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | 63 | splice @{ $_Q->{_datp}->{$_p} }, $_i, 0, @_; | |||||||||||||||||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | 9 | $_Q->_enqueuep($_p, @_); | |||||||||||||||||||||||||||||||||||||||||
| 1016 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||
| 1018 | 90 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||
| 1021 | ## peek ( index ) | ||||||||||||||||||||||||||||||||||||||||||
| 1022 | ## peek ( ) | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | 55 | ▶ | sub _mce_m_peek { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_peek: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||
| 1025 | 55 | my ($_Q, $_i) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||
| 1027 | 55 | ▶ | if ($_i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 40 | ▶ | _croak('Queue: (peek index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 1029 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1031 | 15 | else { $_i = 0 } | |||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||
| 1033 | 55 | ▶ | return undef if (abs($_i) > scalar @{ $_Q->{_datq} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | 40 | ▶ | if (!$_Q->{_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1036 | $_i = ($_i >= 0) | ||||||||||||||||||||||||||||||||||||||||||
| 1037 | 16 | ▶ | ? scalar(@{ $_Q->{_datq} }) - ($_i + 1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1038 | : abs($_i + 1); | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||
| 1041 | 40 | return $_Q->{_datq}->[$_i]; | |||||||||||||||||||||||||||||||||||||||||
| 1042 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||||||||||||
| 1044 | ## peekp ( priority, index ) | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | ## peekp ( priority ) | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||||||||||||||||
| 1047 | 99 | ▶ | sub _mce_m_peekp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_peekp: called CC=10 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1048 | 99 | my ($_Q, $_p, $_i) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||
| 1050 | 99 | ▶ | if ($_i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1051 | 72 | ▶ | _croak('Queue: (peekp index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 1052 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1053 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1054 | 27 | else { $_i = 0 } | |||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||
| 1056 | 99 | ▶ | _croak('Queue: (peekp priority) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_p) or int $_p != $_p
MC/DC0%0/2
not &looks_like_number($_p) or int $_p != $_p
not &looks_like_number($_p)
int $_p != $_p
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_p)B= int $_p != $_p
| |||||||||||||||||||||||||||||||||||||||||||
| 1057 | if (!looks_like_number($_p) || int($_p) != $_p); | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||
| 1059 | 99 | ▶ | return undef unless (exists $_Q->{_datp}->{$_p}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1060 | 99 | ▶ | return undef if (abs($_i) > scalar @{ $_Q->{_datp}->{$_p} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||
| 1062 | 72 | ▶ | if (!$_Q->{_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1063 | $_i = ($_i >= 0) | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | 32 | ▶ | ? scalar(@{ $_Q->{_datp}->{$_p} }) - ($_i + 1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1065 | : abs($_i + 1); | ||||||||||||||||||||||||||||||||||||||||||
| 1066 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||
| 1068 | 72 | return $_Q->{_datp}->{$_p}->[$_i]; | |||||||||||||||||||||||||||||||||||||||||
| 1069 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||
| 1071 | ## peekh ( index ) | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | ## peekh ( ) | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||
| 1074 | 10 | ▶ | sub _mce_m_peekh { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_peekh: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1075 | 10 | my ($_Q, $_i) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | 10 | ▶ | if ($_i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1078 | 5 | ▶ | _croak('Queue: (peekh index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 1079 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | 5 | else { $_i = 0 } | |||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||
| 1083 | 10 | ▶ | return undef if (abs($_i) > scalar @{ $_Q->{_heap} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1084 | 10 | return $_Q->{_heap}->[$_i]; | |||||||||||||||||||||||||||||||||||||||||
| 1085 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||
| 1087 | ## heap ( ) | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||
| 1089 | 5 | ▶ | sub _mce_m_heap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_m_heap: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1090 | 5 | return @{ shift->{_heap} }; | |||||||||||||||||||||||||||||||||||||||||
| 1091 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||
| 1093 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 1094 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | ## Methods for the worker process. | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 1097 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||||||||||||||||
| 1099 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1100 | my ( | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | 37 | $_MCE, $_DAT_LOCK, $_DAT_W_SOCK, $_DAU_W_SOCK, $_chn, $_lock_chn, | |||||||||||||||||||||||||||||||||||||||||
| 1102 | $_dat_ex, $_dat_un, $_len, $_pending | ||||||||||||||||||||||||||||||||||||||||||
| 1103 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||||||||||||
| 1105 | 116 | ▶ | my $_req1 = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||
| 1106 | 116 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||||||||||||||||
| 1108 | 116 | ▶ | $_dat_ex->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1109 | 116 | print({$_DAT_W_SOCK} $_[0].$LF . $_chn.$LF), | |||||||||||||||||||||||||||||||||||||||||
| 1110 | 116 | print({$_DAU_W_SOCK} $_[1], $_[2]); | |||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||
| 1112 | 116 | ▶ | $_dat_un->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1113 | 37 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||
| 1115 | 8 | ▶ | my $_req2 = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1116 | 8 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1117 | 8 | ▶ | local $/ = $LF if ($/ ne $LF); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||
| 1119 | 8 | ▶ | $_dat_ex->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1120 | 8 | print({$_DAT_W_SOCK} $_[0].$LF . $_chn.$LF), | |||||||||||||||||||||||||||||||||||||||||
| 1121 | 8 | print({$_DAU_W_SOCK} $_[1]); | |||||||||||||||||||||||||||||||||||||||||
| 1122 | 8 | <$_DAU_W_SOCK>; | |||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||
| 1124 | 8 | ▶ | $_dat_un->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1125 | 37 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||
| 1127 | 58 | ▶ | my $_req3 = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.7
| |||||||||||||||||||||||||||||||||||||||||||
| 1128 | 58 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1129 | 58 | ▶ | local $/ = $LF if ($/ ne $LF); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||
| 1131 | 58 | ▶ | $_dat_ex->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1132 | 58 | print({$_DAT_W_SOCK} $_[0].$LF . $_chn.$LF), | |||||||||||||||||||||||||||||||||||||||||
| 1133 | 58 | print({$_DAU_W_SOCK} $_[1]); | |||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | 58 | chomp($_len = <$_DAU_W_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | 58 | ▶ | if ($_len < 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1138 | 12 | ▶ | $_dat_un->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1139 | 12 | ▶ | return defined($_[3]) ? () : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||
| 1142 | 46 | read $_DAU_W_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||
| 1143 | 46 | ▶ | $_dat_un->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||
| 1145 | ($_[2] == 1) | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | ? ($_MCE->{thaw}($_buf))->[0] | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | 46 | ▶ | : @{ $_MCE->{thaw}($_buf) }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1148 | 37 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | 28 | ▶ | sub _mce_w_init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_init: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1151 | 28 | ($_MCE) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1152 | 28 | $_chn = $_MCE->{_chn}; | |||||||||||||||||||||||||||||||||||||||||
| 1153 | 28 | $_DAT_LOCK = $_MCE->{_dat_lock}; | |||||||||||||||||||||||||||||||||||||||||
| 1154 | 28 | $_DAT_W_SOCK = $_MCE->{_dat_w_sock}->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 1155 | 28 | $_DAU_W_SOCK = $_MCE->{_dat_w_sock}->[$_chn]; | |||||||||||||||||||||||||||||||||||||||||
| 1156 | 28 | $_lock_chn = $_MCE->{_lock_chn}; | |||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||
| 1158 | 28 | ▶ | if ($_lock_chn) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1159 | # inlined for performance | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | ▶ | $_dat_ex = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | ▶ | my $_pid = $_tid ? $$ .'.'. $_tid : $$; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1162 | CORE::lock($_DAT_LOCK->{_t_lock}), MCE::Util::_sock_ready($_DAT_LOCK->{_r_sock}) | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | ▶ | if $_is_MSWin32; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1164 | MCE::Util::_sysread($_DAT_LOCK->{_r_sock}, my($b), 1), $_DAT_LOCK->{ $_pid } = 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | ▶ | unless $_DAT_LOCK->{ $_pid }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1166 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1167 | 0 | ▶ | $_dat_un = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1168 | 0 | ▶ | my $_pid = $_tid ? $$ .'.'. $_tid : $$; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1169 | syswrite($_DAT_LOCK->{_w_sock}, '0'), $_DAT_LOCK->{ $_pid } = 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1170 | 0 | ▶ | if $_DAT_LOCK->{ $_pid }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1171 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||
| 1174 | 28 | $_all = {}; | |||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||
| 1176 | 37 | ▶ | no strict 'refs'; no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||
| 1178 | 28 | *{ 'MCE::Queue::await' } = \&_mce_w_await; | |||||||||||||||||||||||||||||||||||||||||
| 1179 | 28 | *{ 'MCE::Queue::clear' } = \&_mce_w_clear; | |||||||||||||||||||||||||||||||||||||||||
| 1180 | 28 | *{ 'MCE::Queue::end' } = \&_mce_w_end; | |||||||||||||||||||||||||||||||||||||||||
| 1181 | 28 | *{ 'MCE::Queue::enqueue' } = \&_mce_w_enqueue; | |||||||||||||||||||||||||||||||||||||||||
| 1182 | 28 | *{ 'MCE::Queue::enqueuep' } = \&_mce_w_enqueuep; | |||||||||||||||||||||||||||||||||||||||||
| 1183 | 28 | *{ 'MCE::Queue::dequeue' } = \&_mce_w_dequeue; | |||||||||||||||||||||||||||||||||||||||||
| 1184 | 28 | *{ 'MCE::Queue::dequeue_nb' } = \&_mce_w_dequeue_nb; | |||||||||||||||||||||||||||||||||||||||||
| 1185 | 28 | *{ 'MCE::Queue::dequeue_timed' } = \&_mce_w_dequeue_timed; | |||||||||||||||||||||||||||||||||||||||||
| 1186 | 28 | *{ 'MCE::Queue::pending' } = \&_mce_w_pending; | |||||||||||||||||||||||||||||||||||||||||
| 1187 | 28 | *{ 'MCE::Queue::insert' } = \&_mce_w_insert; | |||||||||||||||||||||||||||||||||||||||||
| 1188 | 28 | *{ 'MCE::Queue::insertp' } = \&_mce_w_insertp; | |||||||||||||||||||||||||||||||||||||||||
| 1189 | 28 | *{ 'MCE::Queue::peek' } = \&_mce_w_peek; | |||||||||||||||||||||||||||||||||||||||||
| 1190 | 28 | *{ 'MCE::Queue::peekp' } = \&_mce_w_peekp; | |||||||||||||||||||||||||||||||||||||||||
| 1191 | 28 | *{ 'MCE::Queue::peekh' } = \&_mce_w_peekh; | |||||||||||||||||||||||||||||||||||||||||
| 1192 | 28 | *{ 'MCE::Queue::heap' } = \&_mce_w_heap; | |||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||
| 1194 | 28 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||
| 1197 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||
| 1199 | 0 | ▶ | sub _mce_w_await { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_await: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1200 | 0 | ▶ | my $_Q = shift; my $_t = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||||||||||||||||
| 1202 | 0 | ▶ | return $_Q->_mce_m_await() if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | _croak('Queue: (await) is not enabled for this queue') | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | ▶ | unless ($_Q->{_await}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | ▶ | _croak('Queue: (await threshold) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not &looks_like_number($_t) or int $_t != $_t
MC/DC0%0/2
not &looks_like_number($_t) or int $_t != $_t
not &looks_like_number($_t)
int $_t != $_t
Truth table0%0/3
not(A) or B
A= not &looks_like_number($_t)B= int $_t != $_t
| |||||||||||||||||||||||||||||||||||||||||||
| 1207 | if (!looks_like_number($_t) || int($_t) != $_t); | ||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | ▶ | $_t = 0 if ($_t < 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1210 | 0 | $_req2->(OUTPUT_W_QUE, $_Q->{_id}.$LF . $_t.$LF); | |||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | ▶ | MCE::Util::_sock_ready($_Q->{_ar_sock}) if $_is_MSWin32; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | MCE::Util::_sysread($_Q->{_ar_sock}, my($_next), 1); | |||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||
| 1218 | 8 | ▶ | sub _mce_w_clear { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_clear: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1219 | 8 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||
| 1221 | 8 | ▶ | return $_Q->_mce_m_clear() if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||
| 1223 | 8 | $_req2->(OUTPUT_C_QUE, $_Q->{_id}.$LF); | |||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||
| 1225 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||
| 1228 | 0 | ▶ | sub _mce_w_end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_end: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | ▶ | return $_Q->_mce_m_end() if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||
| 1233 | 0 | $_req2->(OUTPUT_E_QUE, $_Q->{_id}.$LF); | |||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||
| 1238 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||
| 1240 | 56 | ▶ | sub _mce_w_enqueue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_enqueue: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1241 | 56 | my $_Q = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||
| 1243 | 56 | ▶ | return $_Q->_mce_m_enqueue(@_) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||
| 1245 | 56 | ▶ | if (scalar @_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1246 | 56 | my $_tmp = $_MCE->{freeze}([ @_ ]); | |||||||||||||||||||||||||||||||||||||||||
| 1247 | 56 | my $_buf = $_Q->{_id}.$LF . length($_tmp).$LF; | |||||||||||||||||||||||||||||||||||||||||
| 1248 | 56 | $_req1->(OUTPUT_A_QUE, $_buf, $_tmp); | |||||||||||||||||||||||||||||||||||||||||
| 1249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||
| 1251 | 56 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||
| 1254 | 20 | ▶ | sub _mce_w_enqueuep { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_enqueuep: called CC=5 SCAR=17.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1255 | 20 | my ($_Q, $_p) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||||||||||
| 1257 | 20 | ▶ | return $_Q->_mce_m_enqueuep($_p, @_) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||
| 1259 | 20 | ▶ | _croak('Queue: (enqueuep priority) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_p) or int $_p != $_p
MC/DC0%0/2
not &looks_like_number($_p) or int $_p != $_p
not &looks_like_number($_p)
int $_p != $_p
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_p)B= int $_p != $_p
| |||||||||||||||||||||||||||||||||||||||||||
| 1260 | if (!looks_like_number($_p) || int($_p) != $_p); | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||
| 1262 | 20 | ▶ | if (scalar @_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1263 | 20 | my $_tmp = $_MCE->{freeze}([ @_ ]); | |||||||||||||||||||||||||||||||||||||||||
| 1264 | 20 | my $_buf = $_Q->{_id}.$LF . $_p.$LF . length($_tmp).$LF; | |||||||||||||||||||||||||||||||||||||||||
| 1265 | 20 | $_req1->(OUTPUT_A_QUP, $_buf, $_tmp); | |||||||||||||||||||||||||||||||||||||||||
| 1266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||
| 1268 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||
| 1271 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1272 | |||||||||||||||||||||||||||||||||||||||||||
| 1273 | 243 | ▶ | sub _mce_w_dequeue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_dequeue: called CC=17 SCAR=29.7
| |||||||||||||||||||||||||||||||||||||||||||
| 1274 | 243 | my $_buf; my ($_Q, $_cnt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1275 | |||||||||||||||||||||||||||||||||||||||||||
| 1276 | 243 | ▶ | return $_Q->_mce_m_dequeue($_cnt) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | 243 | ▶ | if (defined $_cnt && $_cnt ne '1') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $_cnt and $_cnt ne 1
MC/DC100%2/2
defined $_cnt and $_cnt ne 1
defined $_cnt
$_cnt ne 1
Truth table100%3/3
A and B
A= defined $_cntB= $_cnt ne 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1279 | 6 | ▶ | _croak('Queue: (dequeue count argument) is not valid') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt) or int $_cnt != $_cnt
MC/DC0%0/3
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt)
int $_cnt != $_cnt
$_cnt < 1
Truth table25%1/4
not(A) or B or C
A= not &looks_like_number($_cnt)B= int $_cnt != $_cntC= $_cnt < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1280 | if (!looks_like_number($_cnt) || int($_cnt) != $_cnt || $_cnt < 1); | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | 237 | $_cnt = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||
| 1285 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1286 | 243 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1287 | 243 | ▶ | local $/ = $LF if ($/ ne $LF); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||||||||||||||||
| 1289 | 243 | ▶ | $_dat_ex->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||
| 1291 | 243 | print({$_DAT_W_SOCK} OUTPUT_D_QUE.$LF . $_chn.$LF), | |||||||||||||||||||||||||||||||||||||||||
| 1292 | 243 | print({$_DAU_W_SOCK} $_Q->{_id}.$LF . $_cnt.$LF); | |||||||||||||||||||||||||||||||||||||||||
| 1293 | 243 | chomp($_len = <$_DAU_W_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||
| 1295 | 243 | ▶ | read($_DAU_W_SOCK, $_buf, $_len) if ($_len >= 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||
| 1297 | 243 | ▶ | $_dat_un->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||
| 1300 | 243 | ▶ | return ($_MCE->{thaw}($_buf))->[0] if ($_len > 0 && $_cnt == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_len > 0 and $_cnt == 1
MC/DC100%2/2
$_len > 0 and $_cnt == 1
$_len > 0
$_cnt == 1
Truth table100%3/3
A and B
A= $_len > 0B= $_cnt == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1301 | 66 | ▶ | return @{ $_MCE->{thaw}($_buf) } if ($_len > 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1302 | 60 | ▶ | return if ($_len == -2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||||||||||||||||
| 1304 | 60 | ▶ | MCE::Util::_sock_ready($_Q->{_qr_sock}) if $_is_MSWin32; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1305 | 60 | MCE::Util::_sysread($_Q->{_qr_sock}, my($_next), 1); | |||||||||||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||||||||||||
| 1307 | 60 | goto \&_mce_w_dequeue; | |||||||||||||||||||||||||||||||||||||||||
| 1308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||
| 1310 | 4 | ▶ | sub _mce_w_dequeue_nb { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_dequeue_nb: called CC=7 SCAR=29.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1311 | 4 | my ($_Q, $_cnt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||
| 1313 | 4 | ▶ | return $_Q->_mce_m_dequeue_nb($_cnt) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1314 | |||||||||||||||||||||||||||||||||||||||||||
| 1315 | 4 | ▶ | if (defined $_cnt && $_cnt ne '1') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_cnt and $_cnt ne 1
MC/DC0%0/2
defined $_cnt and $_cnt ne 1
defined $_cnt
$_cnt ne 1
Truth table33%1/3
A and B
A= defined $_cntB= $_cnt ne 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | ▶ | _croak('Queue: (dequeue_nb count argument) is not valid') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt) or int $_cnt != $_cnt
MC/DC0%0/3
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt)
int $_cnt != $_cnt
$_cnt < 1
Truth table0%0/4
not(A) or B or C
A= not &looks_like_number($_cnt)B= int $_cnt != $_cntC= $_cnt < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1317 | if (!looks_like_number($_cnt) || int($_cnt) != $_cnt || $_cnt < 1); | ||||||||||||||||||||||||||||||||||||||||||
| 1318 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1319 | 4 | $_cnt = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||
| 1322 | 4 | $_req3->(OUTPUT_D_QUN, $_Q->{_id}.$LF . $_cnt.$LF, $_cnt, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | 4 | ▶ | sub _mce_w_dequeue_timed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_dequeue_timed: called CC=22 SCAR=57.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1326 | 4 | my ($_Q, $_timeout, $_cnt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1327 | 4 | my ($_buf, $_start); | |||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||
| 1329 | return $_Q->_mce_m_dequeue_timed($_timeout, $_cnt) | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | 4 | ▶ | if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||
| 1332 | 4 | ▶ | if (defined $_timeout) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1333 | 0 | ▶ | _croak('Queue: (dequeue_timed count argument) is not valid') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1334 | if (!looks_like_number($_timeout)); | ||||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | $_start = MCE::Util::_time(); | |||||||||||||||||||||||||||||||||||||||||
| 1336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||
| 1338 | 4 | ▶ | if (defined $_cnt && $_cnt ne '1') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_cnt and $_cnt ne 1
MC/DC0%0/2
defined $_cnt and $_cnt ne 1
defined $_cnt
$_cnt ne 1
Truth table33%1/3
A and B
A= defined $_cntB= $_cnt ne 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1339 | 0 | ▶ | _croak('Queue: (dequeue_timed count argument) is not valid') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt) or int $_cnt != $_cnt
MC/DC0%0/3
not &looks_like_number($_cnt) or int $_cnt != $_cnt or $_cnt < 1
not &looks_like_number($_cnt)
int $_cnt != $_cnt
$_cnt < 1
Truth table0%0/4
not(A) or B or C
A= not &looks_like_number($_cnt)B= int $_cnt != $_cntC= $_cnt < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1340 | if (!looks_like_number($_cnt) || int($_cnt) != $_cnt || $_cnt < 1); | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | 4 | $_cnt = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||
| 1345 | 4 | ▶ | if (! $_timeout || $_timeout < 0.0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $_timeout or $_timeout < 0
MC/DC0%0/2
not $_timeout or $_timeout < 0
not $_timeout
$_timeout < 0
Truth table33%1/3
not(A) or B
A= not $_timeoutB= $_timeout < 0
| |||||||||||||||||||||||||||||||||||||||||||
| 1346 | 4 | return $_req3->(OUTPUT_D_QUN, $_Q->{_id}.$LF . $_cnt.$LF, $_cnt, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||
| 1349 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | 0 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | ▶ | local $/ = $LF if ($/ ne $LF); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||
| 1353 | 0 | ▶ | $_dat_ex->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | 0 | print({$_DAT_W_SOCK} OUTPUT_D_QUE.$LF . $_chn.$LF), | |||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | print({$_DAU_W_SOCK} $_Q->{_id}.$LF . $_cnt.$LF); | |||||||||||||||||||||||||||||||||||||||||
| 1357 | 0 | chomp($_len = <$_DAU_W_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||
| 1359 | 0 | ▶ | read($_DAU_W_SOCK, $_buf, $_len) if ($_len >= 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||||||||||
| 1361 | 0 | ▶ | $_dat_un->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||
| 1364 | 0 | ▶ | return ($_MCE->{thaw}($_buf))->[0] if ($_len > 0 && $_cnt == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_len > 0 and $_cnt == 1
MC/DC0%0/2
$_len > 0 and $_cnt == 1
$_len > 0
$_cnt == 1
Truth table0%0/3
A and B
A= $_len > 0B= $_cnt == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1365 | 0 | ▶ | return @{ $_MCE->{thaw}($_buf) } if ($_len > 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1366 | 0 | ▶ | return if ($_len == -2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1367 | |||||||||||||||||||||||||||||||||||||||||||
| 1368 | 0 | $_Q->{_qr_mutex}->lock(); | |||||||||||||||||||||||||||||||||||||||||
| 1369 | 0 | $_timeout = $_timeout - (MCE::Util::_time() - $_start) - 0.045; | |||||||||||||||||||||||||||||||||||||||||
| 1370 | 0 | ▶ | $_timeout = 0.0 if $_timeout < 0.045; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | CORE::vec(my $_r, CORE::fileno($_Q->{_qr_sock}), 1) = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | ▶ | if (CORE::select($_r, undef, undef, $_timeout) > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | MCE::Util::_sysread($_Q->{_qr_sock}, my($_next), 1); | |||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | $_Q->{_qr_mutex}->unlock(); | |||||||||||||||||||||||||||||||||||||||||
| 1376 | 0 | return $_req3->(OUTPUT_D_QUN, $_Q->{_id}.$LF . $_cnt.$LF, $_cnt, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | $_Q->{_qr_mutex}->unlock(); | |||||||||||||||||||||||||||||||||||||||||
| 1380 | 0 | $_req2->(OUTPUT_D_QUT, $_Q->{_id}.$LF); | |||||||||||||||||||||||||||||||||||||||||
| 1381 | 0 | MCE::Util::_sleep(0.045); # yield | |||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||
| 1383 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 1384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||||||||||||
| 1386 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||||||||||||||||
| 1388 | 4 | ▶ | sub _mce_w_pending { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_pending: called CC=7 SCAR=20.6
| |||||||||||||||||||||||||||||||||||||||||||
| 1389 | 4 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||
| 1391 | 4 | ▶ | return $_Q->_mce_m_pending() if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||
| 1393 | 4 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1394 | 4 | ▶ | local $/ = $LF if ($/ ne $LF); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||||||||||
| 1396 | 4 | ▶ | $_dat_ex->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1397 | 4 | print({$_DAT_W_SOCK} OUTPUT_N_QUE.$LF . $_chn.$LF), | |||||||||||||||||||||||||||||||||||||||||
| 1398 | 4 | print({$_DAU_W_SOCK} $_Q->{_id}.$LF); | |||||||||||||||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||||||||||||||||
| 1400 | 4 | chomp($_pending = <$_DAU_W_SOCK>); | |||||||||||||||||||||||||||||||||||||||||
| 1401 | 4 | ▶ | $_dat_un->() if $_lock_chn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||||||||||||
| 1403 | 4 | ▶ | length($_pending) ? int($_pending) : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1404 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||
| 1406 | 20 | ▶ | sub _mce_w_insert { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_insert: called CC=5 SCAR=17.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1407 | 20 | my ($_Q, $_i) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||||||||||||||||
| 1409 | 20 | ▶ | return $_Q->_mce_m_insert($_i, @_) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1410 | |||||||||||||||||||||||||||||||||||||||||||
| 1411 | 20 | ▶ | _croak('Queue: (insert index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 1412 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||||||||||||
| 1414 | 20 | ▶ | return unless (scalar @_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||||||||||||||||
| 1416 | 20 | my $_tmp = $_MCE->{freeze}([ @_ ]); | |||||||||||||||||||||||||||||||||||||||||
| 1417 | 20 | my $_buf = $_Q->{_id}.$LF . $_i.$LF . length($_tmp).$LF . $_tmp; | |||||||||||||||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||||||||||||||||
| 1419 | 20 | $_req1->(OUTPUT_I_QUE, $_buf, ''); | |||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||
| 1421 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||
| 1424 | 20 | ▶ | sub _mce_w_insertp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_insertp: called CC=7 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1425 | 20 | my ($_Q, $_p, $_i) = (shift, shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 1426 | |||||||||||||||||||||||||||||||||||||||||||
| 1427 | 20 | ▶ | return $_Q->_mce_m_insertp($_p, $_i, @_) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||||||||||
| 1429 | 20 | ▶ | _croak('Queue: (insertp priority) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_p) or int $_p != $_p
MC/DC0%0/2
not &looks_like_number($_p) or int $_p != $_p
not &looks_like_number($_p)
int $_p != $_p
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_p)B= int $_p != $_p
| |||||||||||||||||||||||||||||||||||||||||||
| 1430 | if (!looks_like_number($_p) || int($_p) != $_p); | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | 20 | ▶ | _croak('Queue: (insertp index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 1432 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||
| 1434 | 20 | ▶ | return unless (scalar @_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||||||||||||
| 1436 | 20 | my $_tmp = $_MCE->{freeze}([ @_ ]); | |||||||||||||||||||||||||||||||||||||||||
| 1437 | 20 | my $_buf = $_Q->{_id}.$LF . $_p.$LF . $_i.$LF . length($_tmp).$LF . $_tmp; | |||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||
| 1439 | 20 | $_req1->(OUTPUT_I_QUP, $_buf, ''); | |||||||||||||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||||||||||||
| 1441 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||
| 1444 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||
| 1446 | 22 | ▶ | sub _mce_w_peek { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_peek: called CC=5 SCAR=17.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1447 | 22 | ▶ | my $_Q = shift; my $_i = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 1448 | |||||||||||||||||||||||||||||||||||||||||||
| 1449 | 22 | ▶ | return $_Q->_mce_m_peek($_i, @_) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1450 | |||||||||||||||||||||||||||||||||||||||||||
| 1451 | 22 | ▶ | _croak('Queue: (peek index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 1452 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||
| 1454 | 22 | $_req3->(OUTPUT_P_QUE, $_Q->{_id}.$LF . $_i.$LF, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||
| 1457 | 22 | ▶ | sub _mce_w_peekp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_peekp: called CC=7 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1458 | 22 | ▶ | my ($_Q, $_p) = (shift, shift); my $_i = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||
| 1460 | 22 | ▶ | return $_Q->_mce_m_peekp($_p, $_i, @_) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||
| 1462 | 22 | ▶ | _croak('Queue: (peekp priority) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_p) or int $_p != $_p
MC/DC0%0/2
not &looks_like_number($_p) or int $_p != $_p
not &looks_like_number($_p)
int $_p != $_p
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_p)B= int $_p != $_p
| |||||||||||||||||||||||||||||||||||||||||||
| 1463 | if (!looks_like_number($_p) || int($_p) != $_p); | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | 22 | ▶ | _croak('Queue: (peekp index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 1465 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||||||||||||||||
| 1467 | 22 | $_req3->(OUTPUT_P_QUP, $_Q->{_id}.$LF . $_p.$LF . $_i.$LF, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | |||||||||||||||||||||||||||||||||||||||||||
| 1470 | 4 | ▶ | sub _mce_w_peekh { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_peekh: called CC=6 SCAR=19.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1471 | 4 | ▶ | my $_Q = shift; my $_i = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 1472 | |||||||||||||||||||||||||||||||||||||||||||
| 1473 | 4 | ▶ | return $_Q->_mce_m_peekh($_i, @_) if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||||||||||||||||
| 1475 | 4 | ▶ | _croak('Queue: (peekh index) is not an integer') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &looks_like_number($_i) or int $_i != $_i
MC/DC0%0/2
not &looks_like_number($_i) or int $_i != $_i
not &looks_like_number($_i)
int $_i != $_i
Truth table33%1/3
not(A) or B
A= not &looks_like_number($_i)B= int $_i != $_i
| |||||||||||||||||||||||||||||||||||||||||||
| 1476 | if (!looks_like_number($_i) || int($_i) != $_i); | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||
| 1478 | 4 | my $_ret = $_req3->(OUTPUT_P_QUH, $_Q->{_id}.$LF . $_i.$LF, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||||||||||||||||
| 1480 | 4 | ▶ | length($_ret) ? int($_ret) : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1481 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1482 | |||||||||||||||||||||||||||||||||||||||||||
| 1483 | 2 | ▶ | sub _mce_w_heap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mce_w_heap: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1484 | 2 | my ($_Q) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||
| 1486 | 2 | ▶ | return $_Q->_mce_m_heap() if (exists $_all->{ $_Q->{_id} }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||
| 1488 | 2 | $_req3->(OUTPUT_H_QUE, $_Q->{_id}.$LF, 0); | |||||||||||||||||||||||||||||||||||||||||
| 1489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||||||||||||
| 1491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||
| 1493 | 37 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||
| 1495 | __END__ | ||||||||||||||||||||||||||||||||||||||||||