I am trying to execute a subroutine which acceses database and other things online. Instead of waiting for each response, i want to create a queue of the sub being called 500 times, as subs finish, new ones are added to always keep it at 500 items in the queue being executed at the same time. here is what i have so far.

#!/usr/local/bin/perl

        
# Packages Needed
use threads;
use Thread::Queue;


sub doThisLotsofTimes {
        # Do something here
}


for my $i (1 .. 500) {
        $stream->enqueue($i);
}

$stream->enqueue(undef);
$kid = new threads(\&check_num, $downstream, $num);
$kid->join;
$downstream->enqueue(undef) if $kid;


# EOF-

if someone could help me out that would be great!


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to