| 1 | package Thread::Stack; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use threads::shared; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | |||||||||||
| 9 | 1 | our $VERSION = '1.00'; | |||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 13 | 1 | my $class = shift; | |||||||||
| 14 | 1 | my @q : shared = @_; | |||||||||
| 15 | 1 | return bless \@q, $class; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | sub pop { | ||||||||
|
Subroutine
pop: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||
| 19 | 1 | my $q = shift; | |||||||||
| 20 | 1 | lock(@$q); | |||||||||
| 21 | 1 | ▶ | cond_wait @$q until @$q; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 1 | ▶ | cond_signal @$q if @$q > 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 1 | return CORE::pop @$q; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub pop_nb { | ||||||||
|
Subroutine
pop_nb: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 27 | 0 | my $q = shift; | |||||||||
| 28 | 0 | lock(@$q); | |||||||||
| 29 | 0 | return CORE::pop @$q; | |||||||||
| 30 | } | ||||||||||
| 31 | 2 | ▶ | sub push { | ||||||||
|
Subroutine
push: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 32 | 2 | my $q = shift; | |||||||||
| 33 | 2 | lock(@$q); | |||||||||
| 34 | 2 | ▶ | push @$q, @_ and cond_signal @$q; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 2 | ▶ | sub size { | ||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 38 | 2 | my $q = shift; | |||||||||
| 39 | 2 | lock(@$q); | |||||||||
| 40 | 2 | return scalar(@$q); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 1 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||