PrePAN

Sign in to PrePAN

Thread::Queue::MaxSize A threaded queue with a defined upper bound

Good

Synopsis

use strict;
use warnings;

use threads;
use Thread::Queue::MaxSize;

# create a new empty queue with no max limit
my $q = Thread::Queue::MaxSize->new();

# create a new empty queue that will only ever store 1000 entries
my $q = Thread::Queue::MaxSize->new({ maxsize => 1000 });

# create a new empty queue with no max limit and some default values
my $q = Thread::Queue::MaxSize->new({}, $foo, $bar, @qwerty);

# create a new empty queue with some default values that will only ever
# store 1000 entries
my $q = Thread::Queue::MaxSize->new({ maxsize => 1000 }, $foo, $bar, @qwerty);

Description

This is a further implementation of Thread::Queue that adds upper bounds on the queue size.

Comments

anonymouse
Anonymous
Do you really need a separate module for this? Why not ask the author of Thread::Queue if he's willing to include the functionality in his module and then you can submit a patch.
I'm not sure how I could go about setting the maximum size with just a patch. There didn't seem to be an obvious entry point. However, I will send a request on to the author regardless.
anonymouse
Anonymous
A patch is just a diff of the original source vs the proposed new source (`man patch` for more info). You could also use github pull request, etc.

Please sign up to post a review.