Im having a problem launching multiple sub routines as threads. My script seems to stop when the first thread is launched.
Im condensing the code for simplification here:
#!/usr/bin/perl -w
use strict;
use threads;
srand;
my ($cnt,$line,$iprange_rand);
my (@iprange,@rcodes,@checkid,@rettxt);
...
sub mysub ()
{ my argvar=$_[0];
while ( 1 == 1 )
{ my argvar=$_[0];
system("/bin/echo","$argvar");
select(undef, undef, undef, 0.001);
}
}
my @thrSub;
for ( $cnt = 0; $cnt <= 24; $cnt++ )
{ $thrSub[$cnt]=threads->new(\&mysub([$cnt]));
}
any ideas why it hangs on launching the first thread?