Hi,
here is my testscript...
------------------------8<------------------------
#!/usr/bin/perl -w
use strict;
use threads;
foreach my $threads (1,2,4,8,16,32,64,128,256,512) {
print "starting $threads worker...";
my @worker;
push(@worker, threads->new( sub {
my $count = 0;
my $maxcount = 10000;
while (1) {
$count++;
last if $count == $maxcount;
}
}))foreach 1..$threads;
print " done\n";
print "waiting for all running workers...";
foreach my $t (@worker) {
if ($t->tid && !threads::equal($t, threads->self)) {
$t->join;
}
}
print " done\n\n";
}
print "all done...\n";
print "waiting for all running threads...";
foreach my $t (threads->list) {
if ($t->tid && !threads::equal($t, threads->self)) {
$t->join;
}
}
print " done\n";
sleep 20;
------------------------8<------------------------
in the �sleep 20;� on �top�
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
26065 root 19 0 265M 265M 1476 S 0,0 52,7 0:24 met.pl
the script use 256M memory after all workers are done!
where is the error?
ps: sorry for my worst english ;)
cya later
/Stephan