Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

thread::pool::simple(3pm) [debian man page]

Simple(3pm)						User Contributed Perl Documentation					       Simple(3pm)

NAME
Thread::Pool::Simple - A simple thread-pool implementation SYNOPSIS
use Thread::Pool::Simple; my $pool = Thread::Pool::Simple->new( min => 3, # at least 3 workers max => 5, # at most 5 workers load => 10, # increase worker if on average every worker has 10 jobs waiting init => [&init_handle, $arg1, $arg2, ...] # run before creating worker thread pre => [&pre_handle, $arg1, $arg2, ...] # run after creating worker thread do => [&do_handle, $arg1, $arg2, ...] # job handler for each worker post => [&post_handle, $arg1, $arg2, ...] # run before worker threads end passid => 1, # whether to pass the job id as the first argument to the &do_handle lifespan => 10000, # total jobs handled by each worker ); my ($id1) = $pool->add(@arg1); # call in list context my $id2 = $pool->add(@arg2); # call in scalar conetxt $pool->add(@arg3) # call in void context my @ret = $pool->remove($id1); # get result (block) my $ret = $pool->remove_nb($id2); # get result (no block) $pool->cancel($id1); # cancel the job $pool->cancel_all(); # cancel all jobs $pool->join(); # wait till all jobs are done $pool->detach(); # don't wait. DESCRIPTION
"Thread::Pool::Simple" provides a simple thread-pool implementaion without external dependencies outside core modules. Jobs can be submitted to and handled by multi-threaded `workers' managed by the pool. AUTHOR
Jianyuan Wu, <jwu@cpan.org> COPYRIGHT AND LICENSE
Copyright 2007 by Jianyuan Wu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-10-04 Simple(3pm)

Check Out this Related Man Page

libapache2-mod-perl2-2.0.7::docs::api::APR::BucketAlloc(User Contributed Perl Documentlibapache2-mod-perl2-2.0.7::docs::api::APR::BucketAlloc(3pm)

NAME
APR::BucketAlloc - Perl API for Bucket Allocation Synopsis use APR::BucketAlloc (); $ba = APR::BucketAlloc->new($pool); $ba->destroy; Description "APR::BucketAlloc" is used for bucket allocation. "new" Create an "APR::BucketAlloc" object: $ba = APR::BucketAlloc->new($pool); class: "APR::BucketAlloc" arg1: $pool ( "APR::Pool object" ) The pool used to create this object. ret: $ba ( "APR::BucketAlloc object" ) The new object. since: 2.0.00 This bucket allocation list (freelist) is used to create new buckets (via "APR::Bucket->new") and bucket brigades (via "APR::Brigade->new"). You only need to use this method if you aren't running under httpd. If you are running under mod_perl, you already have a bucket allocation available via "$c->bucket_alloc" and "$bb->bucket_alloc". Example: use APR::BucketAlloc (); use APR::Pool (); my $ba = APR::BucketAlloc->(APR::Pool->pool); my $eos_b = APR::Bucket::eos_create($ba); "destroy" Destroy an "APR::BucketAlloc object": $ba->destroy; arg1: $ba ( "APR::BucketAlloc object" ) The freelist to destroy. ret: no return value since: 2.0.00 Once destroyed this object may not be used again. You need to destroy $ba only if you have created it via "APR::BucketAlloc->new". If you try to destroy an allocation not created by this method, you will get a segmentation fault. Moreover normally it is not necessary to destroy allocators, since the pool which created them will destroy them during that pool's cleanup phase. See Also mod_perl 2.0 documentation. Copyright mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. Authors The mod_perl development team and numerous contributors. perl v5.14.2 2011-02-08 libapache2-mod-perl2-2.0.7::docs::api::APR::BucketAlloc(3pm)
Man Page