On 2007-02-09 00:53:04 +0200, Teodor Cimpoesu wrote:
> respectiv:
> use threads;
> sub do_work {
> print "arg: $1";
^^^^^^^^^
cred ca aici ai vrut sa spui @_
> }
> my @threads = [];
# nonsens, chiar daca se compileaza :)
my $threads = [];
# sau
my @threads = ();
> for $x (0..9) {
> $threads[$x] = threads->new(\&do_work, $x);
> }
> for (@threads) { $_->join; }
>
> ma rog, sfatul meu este sa stai departe de Perl, Python rulz :-))
iae, n-as recomanda lucrul cu threaduri in nici un limbaj dinamic,
nu au implementari eficiente. Forking is the old/stable/unixish way
still.
On topic totusi, ca raspuns la mailul initial al threadului as
recomanda Parallel::ForkManager:
http://search.cpan.org/~dlux/Parallel-ForkManager-0.7.5/ForkManager.pm
Are documentatie competenta, cu exemple.
bafta.
--
perl -MLWP::Simple -e'print$_[rand(split(q.%%\n.,
get(q{http://cpan.org/misc/japh})))]'
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug