-
-
14 Nov 2017 03:00:05 UTC
- Distribution: Coro-ProcessPool
- Module version: 0.30
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (560 / 0 / 26)
- Kwalitee
Bus factor: 1- 68.80% Coverage
- License: perl_5
- Perl: v5.10.0
- Activity
24 month- Tools
- Download (17.55KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Coro::ProcessPool::Pipeline - A producer/consumer pipeline for Coro::ProcessPool
VERSION
version 0.30
SYNOPSIS
my $pool = Coro::ProcesPool->new(); my $pipe = $pool->pipeline; # Start producer thread to queue tasks my $producer = async { while (my $task = get_next_task()) { $pipe->queue('Some::TaskClass', $task); } # Let the pipeline know no more tasks are coming $pipe->shutdown; }; # Collect the results of each task as they are received while (my $result = $pipe->next) { do_stuff_with($result); }
DESCRIPTION
Provides an iterative mechanism for feeding tasks into the process pool and collecting results. A pool may have multiple pipelines.
ATTRIBUTES
pool (required)
The Coro::ProcessPool in which to queue tasks.
auto_shutdown (default: false)
When set to true, the pipeline will shut itself down as soon as the number of pending tasks hits zero. At least one task must be sent for this to be triggered.
METHODS
next
Cedes control until a previously queued task is complete and the result is available.
queue($task, $args)
Queues a new task. Arguments are identical to "process" in Coro::ProcessPool and "defer" in Coro::ProcessPool.
shutdown
Signals shutdown of the pipeline. A shutdown pipeline may not be reused.
AUTHOR
Jeff Ober <sysread@fastmail.fm>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Jeff Ober.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Coro::ProcessPool, copy and paste the appropriate command in to your terminal.
cpanm Coro::ProcessPool
perl -MCPAN -e shell install Coro::ProcessPool
For more information on module installation, please visit the detailed CPAN module installation guide.