- or download this
use threads;
use strict;
...
my $thr = threads->new($sub1)->join;
undef $thr;
}
- or download this
i=0; while :; do A=$(ps -C threads3 -o ppid,pid,cmd,rss --no-headers);
+ [ -n "$A" ] && echo $i $A || i=0 ; sleep 1; i=$(($i+1)); done
- or download this
# $sub1 = sub { my $a=[ 1 .. 10000] };
1 19959 1137 /usr/bin/perl ./threads3 5276
...
642 19959 13288 /usr/bin/perl ./threads3 400640
643 19959 13288 /usr/bin/perl ./threads3 401312
644 19959 13288 /usr/bin/perl ./threads3 401980