NAME

MCE::Queue - Provides queues for Many-Core Engine.

VERSION

This document describes MCE::Queue version 1.499_001

SYNOPSIS

use MCE;
use MCE::Queue;

my $q = MCE::Queue->new();

$q->enqueue( $item1 [, $item2, ...] );
$q->enqueuep( $p, $item1 [, $item2, ...] );

$q->dequeue( [ $count ] );
$q->dequeue_nb( [ $count ] );

## TODO ... will finish this prior to the final MCE 1.5 release

DESCRIPTION

TODO ... See MCE::Flow for use_case in the meantime.

IMPORT

One can pass two options to override the default mode used for priority queues (has no effect to normal queuing).

porder => $HIGHEST = Highest priority items are dequeued first
          $LOWEST  = Lowest priority items are dequeued first

type   => $FIFO    = First in, first out
          $LILO    =    (Synonym for FIFO)
          $LIFO    = Last in, first out
          $FILO    =    (Synonym for LIFO)

use MCE::Queue porder => $MCE::Queue::HIGHEST, type => $MCE::Queue::FIFO;

use MCE::Queue;      same as above

THREE MODES OF USE

MCE::Queue can be utilized in the following 3 modes:

A) use MCE;           B) use MCE::Queue;    C) use MCE::Queue;
   use MCE::Queue;       use MCE;

A) Loading MCE prior to inclusion of MCE::Queue. The dequeue method blocks for the manager process and workers. The manager process contains the data. Workers send/request data.

Creating a queue from inside the worker will run the queue in standalone mode. Think workers being able to have local queues.

B) Loading MCE::Queue prior to inclusion of MCE. Queues behave as if running in standalone mode for both the manager and worker processes for the duration of the script.

C) Standalone mode without the inclusion of MCE. The dequeue method is non-blocking in this mode. This mode is speedy due to minimum overhead. In essense, the MCE module is not required to use MCE::Queue.

API

TODO ...

new
porder
type
enqueue
enqueuep
dequeue
dequeue_nb
insert
insertp
pending
peek
peekh
peekp
heap

SEE ALSO

MCE::Flow, MCE::Grep, MCE::Loop, MCE::Map, MCE::Stream, MCE

AUTHOR

Mario E. Roy, <marioeroy AT gmail DOT com>

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.