diff options
Diffstat (limited to 'contrib/perl5/ext/Thread/Thread/Queue.pm')
-rw-r--r-- | contrib/perl5/ext/Thread/Thread/Queue.pm | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/contrib/perl5/ext/Thread/Thread/Queue.pm b/contrib/perl5/ext/Thread/Thread/Queue.pm index 6d5f82be3444..831573c72658 100644 --- a/contrib/perl5/ext/Thread/Thread/Queue.pm +++ b/contrib/perl5/ext/Thread/Thread/Queue.pm @@ -67,15 +67,13 @@ sub new { return bless [@_], $class; } -sub dequeue { - use attrs qw(locked method); +sub dequeue : locked : method { my $q = shift; cond_wait $q until @$q; return shift @$q; } -sub dequeue_nb { - use attrs qw(locked method); +sub dequeue_nb : locked : method { my $q = shift; if (@$q) { return shift @$q; @@ -84,14 +82,12 @@ sub dequeue_nb { } } -sub enqueue { - use attrs qw(locked method); +sub enqueue : locked : method { my $q = shift; push(@$q, @_) and cond_broadcast $q; } -sub pending { - use attrs qw(locked method); +sub pending : locked : method { my $q = shift; return scalar(@$q); } |