Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    Thread::Workers 0.04

    Download button

    No screenshots available
    Downloads: 84  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Kal Aeolian | More programs
    Perl Artistic License / FREE
    September 4th, 2012, 17:04 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Thread::Workers description

    Creates a "boss" which feeds a queue, which is serviced by a pool of threads called "workers"

    Thread::Workers is a Perl module that utilizes threads, Thread::Sempahore, and Thread::Queue to create a pool of workers which are serviced with work by a boss thread. The boss thread could be fed data from a socket listening on the master thread, or could have a routine to check a database for work.

    SYNOPSIS

     use Thread::Workers;
     
     my $pool = Thread::Workers->new();
     $pool->set_boss_fetch_cb(\&function_returns_work);
     $pool->set_boss_log_cb(\&function_processes_worker_returns);
     $pool->set_worker_work_cb(\&function_does_work);
     $pool->start_boss();
     $pool->start_workers();
     $pool->add_worker();
     $pool->sleep_workers();
     $pool->wake_workers();
     
     #internal control loops
     # we have orders to increase the load! add 500 workers
     for (1..500) {
     $pool->add_worker();
     }

     #time to cleanup

     $pool->stop_boss(); #signal boss thread to die
     $pool->stop_workers(); #stop the workers, may leave unfinished items in queue.
     # Or!
     $pool->stop_finish_work(); #gracefully stop boss and finish work queue, then shut down workers.



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    queue feed | Perl module | Perl | queue | feed

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM