summaryrefslogtreecommitdiff
path: root/dist/Thread-Queue
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-03-11 14:43:33 -0700
committerKarl Williamson <khw@cpan.org>2016-03-11 14:49:26 -0700
commite46aa1ddb7d58d270bbc45cef016b0577cfdecaa (patch)
tree2c2bae16536e85b2786e98dda62579ffa5c90c27 /dist/Thread-Queue
parentfa6c7d00a8b0cf48c0f78066f87065cfb43d601b (diff)
downloadperl-e46aa1ddb7d58d270bbc45cef016b0577cfdecaa.tar.gz
Fix various pod errors.
Mostly these are too long verbatim lines.
Diffstat (limited to 'dist/Thread-Queue')
-rw-r--r--dist/Thread-Queue/lib/Thread/Queue.pm44
1 files changed, 23 insertions, 21 deletions
diff --git a/dist/Thread-Queue/lib/Thread/Queue.pm b/dist/Thread-Queue/lib/Thread/Queue.pm
index 5a031ff5bd..f1a08c73b1 100644
--- a/dist/Thread-Queue/lib/Thread/Queue.pm
+++ b/dist/Thread-Queue/lib/Thread/Queue.pm
@@ -3,7 +3,7 @@ package Thread::Queue;
use strict;
use warnings;
-our $VERSION = '3.07';
+our $VERSION = '3.08';
$VERSION = eval $VERSION;
use threads::shared 1.21;
@@ -485,13 +485,14 @@ Sets the size of the queue. If set, calls to C<enqueue()> will block until
the number of pending items in the queue drops below the C<limit>. The
C<limit> does not prevent enqueuing items beyond that count:
- my $q = Thread::Queue->new(1, 2);
- $q->limit = 4;
- $q->enqueue(3, 4, 5); # Does not block
- $q->enqueue(6); # Blocks until at least 2 items are dequeued
-
- my $size = $q->limit; # Returns the current limit (may return 'undef')
- $q->limit = 0; # Queue size is now unlimited
+ my $q = Thread::Queue->new(1, 2);
+ $q->limit = 4;
+ $q->enqueue(3, 4, 5); # Does not block
+ $q->enqueue(6); # Blocks until at least 2 items are
+ # dequeued
+ my $size = $q->limit; # Returns the current limit (may return
+ # 'undef')
+ $q->limit = 0; # Queue size is now unlimited
=item ->end()
@@ -513,14 +514,14 @@ To prevent the contents of a queue from being modified by another thread
while it is being examined and/or changed, L<lock|threads::shared/"lock
VARIABLE"> the queue inside a local block:
- {
- lock($q); # Keep other threads from changing the queue's contents
- my $item = $q->peek();
- if ($item ...) {
- ...
- }
- }
- # Queue is now unlocked
+ {
+ lock($q); # Keep other threads from changing the queue's contents
+ my $item = $q->peek();
+ if ($item ...) {
+ ...
+ }
+ }
+ # Queue is now unlocked
=over
@@ -593,11 +594,12 @@ of the queue (similar to C<dequeue_nb>) if the count overlaps the head of the
queue from the specified position (i.e. if queue size + index + count is
greater than zero):
- $q->enqueue(qw/foo bar baz/);
- my @nada = $q->extract(-6, 2); # Returns () - (3+(-6)+2) <= 0
- my @some = $q->extract(-6, 4); # Returns (foo) - (3+(-6)+4) > 0
- # Queue now contains: bar, baz
- my @rest = $q->extract(-3, 4); # Returns (bar, baz) - (2+(-3)+4) > 0
+ $q->enqueue(qw/foo bar baz/);
+ my @nada = $q->extract(-6, 2); # Returns () - (3+(-6)+2) <= 0
+ my @some = $q->extract(-6, 4); # Returns (foo) - (3+(-6)+4) > 0
+ # Queue now contains: bar, baz
+ my @rest = $q->extract(-3, 4); # Returns
+ # (bar, baz) - (2+(-3)+4) > 0
=back