NAME

Parallel::Tiny

DESCRIPTION

Provides a very simple, no frills fork manager.

SYNOPSIS

my $obj = My::Handler->new();

my $forker = Parallel::Tiny->new(
    handler    => $obj,
    maxprocs   => 4,
    totalprocs => 'infinite',
);

$forker->run();

METHODS

new()

Returns a new Parallel::Tiny fork manager.

takes arguments as a hash or hashref with the following arguments:

handler - an object you provide which has a run() method
          (required)

maxprocs - the number of simoltaneous forked processes you
           want to allow at one time
           (default 1)

totalprocs - the total number of processes that you want to run
             (default 1)

reap_timeout - the number of seconds to wait between runs of
               waitpid() to reap children
               (default .1)

You can for instance, say that you want to run 100 proccesses, but only 4 at a time like this:

my $forker = Parallel::Tiny->new(
    handler => $obj,
    maxprocs => 4,
    totalprocs => 100,
);

If you want you can provide 'infinite' for totalprocs. If you do this, you're responsible for stopping the fork manager!

run()

Start spooling jobs according to the configuration.

waitqueue()

Blocks until a job slot is available.