NAME

Thread::Queue::MaxSize - Thread-safe queues with an upper bound

VERSION

This document describes Thread::Queue::MaxSize version 1.02

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 items
my $q = Thread::Queue::MaxSize->new({ maxsize => 1000 });

# create a queue that will die when too many items are enqueued
my $q = Thread::Queue::MaxSize->new({ maxsize => 1000, on_maxsize => 'die' });

DESCRIPTION

This is a subclass to Thread::Queue that will enforce an upper bound on the number of items in a queue. This can be used to prevent memory use from exploding on a queue that might never empty.

QUEUE CREATION

->new()

Creates a new empty queue. This queue will have no items to start.

->new(OPTIONS)

Creates a new empty queue with some options. The two configurable options are:

maxsize

Defines the maximum size that the queue can ever be.

on_maxsize

Defines the action that will be taken when a queue reaches its maximum size. There are five actions that can be taken when the list of items to enqueue or insert would cause the queue to go over its maximum size. In all cases either the all items are enqueued/inserted or none of the items are enqueued/inserted.

die

No items will be enqueued/inserted and the queue will throw an exception.

warn_and_reject

No items will be enqueued/inserted and the queue will issue a warning.

silent_reject

No items will be enqueued/inserted and no indication will be given as to why.

All items will be enqueued/inserted, the oldest items on the list will be truncated off the end, and the queue will issue a warning.

All items will be enqueued/insertd, the oldest items on the list will be truncated off the end, and no indication will be given as to why. This is the default action.

SEE ALSO

Thread::Queue, threads, threads::shared

MAINTAINER

Paul Lockaby <plockaby AT cpan DOT org>

CREDIT

Significant portions of this module are directly from Thread::Queue which is maintained by Jerry D. Hedden, <jdhedden AT cpan DOT org>.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 255:

=back doesn't take any parameters, but you said =back warn_and_truncate

Around line 260:

=back doesn't take any parameters, but you said =back silent_truncate