From: Jarkko Hietaniemi Date: Fri, 10 May 2002 15:06:52 +0000 (+0000) Subject: Move pod, add $VERSION. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=78f7020ac7bebedf21cc49b06704a43770868392;p=p5sagit%2Fp5-mst-13.2.git Move pod, add $VERSION. p4raw-id: //depot/perl@16537 --- diff --git a/ext/threads/shared/queue.pm b/ext/threads/shared/queue.pm index 557833a..02a5c2c 100644 --- a/ext/threads/shared/queue.pm +++ b/ext/threads/shared/queue.pm @@ -1,48 +1,9 @@ - package threads::shared::queue; use threads::shared; use strict; -sub new { - my $class = shift; - my @q : shared = @_; - my $q = \@q; - return bless $q, $class; -} - -sub dequeue { - my $q = shift; - lock(@$q); - until(@$q) { - cond_wait(@$q); - } - return shift @$q; -} - -sub dequeue_nb { - my $q = shift; - lock(@$q); - if (@$q) { - return shift @$q; - } else { - return undef; - } -} - -sub enqueue { - my $q = shift; - lock(@$q); - push(@$q, @_) and cond_broadcast @$q; -} - -sub pending { - my $q = shift; - lock(@$q); - return scalar(@$q); -} - -1; +our $VERSION = '1.00'; =head1 NAME @@ -104,3 +65,44 @@ L, L =cut +sub new { + my $class = shift; + my @q : shared = @_; + my $q = \@q; + return bless $q, $class; +} + +sub dequeue { + my $q = shift; + lock(@$q); + until(@$q) { + cond_wait(@$q); + } + return shift @$q; +} + +sub dequeue_nb { + my $q = shift; + lock(@$q); + if (@$q) { + return shift @$q; + } else { + return undef; + } +} + +sub enqueue { + my $q = shift; + lock(@$q); + push(@$q, @_) and cond_broadcast @$q; +} + +sub pending { + my $q = shift; + lock(@$q); + return scalar(@$q); +} + +1; + +