perl pra wrote:
> 
> I want to create 100 threads/processes  simaltaneoulsy (at the same time),
> and those 100 threads/processes  should  execute a subrountine at the same
> time.
> 
> can anybody help me giving some ideas reagarding this, I tried creating this
> 100  process using fork in a for loop but that does not server the purpose.
> 
> I even tried with Parallel::ForkManager; but it did not work for me.
> 
> Please help me in this.

Hi Siva

Take a look at the 'threads' pragma. The sample program below may help you.

Rob


use strict;
use warnings;

use threads;

sub threadsub {
  my $val = shift;
  print "Thread $val\n";
}

my @threads;

for (1 .. 100) {
  my $thr = threads->create(\&threadsub, $_);
  push @threads, $thr;
}

$_->join foreach @threads;

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


Reply via email to