« microsoft 802.11g usb 2.0 paddle | Main | bay area radio »

poor man's threads

this is easily the most useful perl module i've found in recent history: Parallel::ForkManager. doing something in parallel without the overhead of actually writing really multithreaded code is quite cool.

use Parallel::ForkManager;
$pm = new Parallel::ForkManager($MAX_PROCESSES);

foreach $data (@all_data) {
# Forks and returns the pid for the child:
my $pid = $pm->start and next;
work goes here
$pm->finish; # Terminates the child process
}

highly inelegant and hardly clean, but damn this is useful.

TrackBack

TrackBack URL for this entry:
http://bengt.org/mt/mt-tb.cgi/100

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on May 13, 2004 12:00 AM.

The previous post in this blog was microsoft 802.11g usb 2.0 paddle.

The next post in this blog is bay area radio.

Many more can be found on the main index page or by looking through the archives.